Agencies may have many contacts.
Agency
id int
name nvarchar(100)
Contact
id int
email nvarchar(100)
agency_id int
How would you make a Stored Procedure so it returns a resultset that contains each Agency and its Contacts in one row?, so let's say you have one agency with three contacts, you'll end up with.
-----------------------------------------------------------------
| agency_name | contact_1 | contact_2 | contact_3 |
|---------------------------------------------------------------|
| Foo | Foo1@Foo1.com | Foo2@Foo2.com | Foo3@Foo3.com |
-----------------------------------------------------------------
It's apparent that one would need to count the MAX amount of joined contacts an agency may have.