Subject Problem with sql
Author Sandeep Chandra
The following query returns a separate line for each animal with client
details duplicated as expected.

select C.Number, C.Name, A.Number, A.Name
from Client C left outer join Animal A on A.Owner = C.Number

As a user option we need to select the first animal that matches (ie
distinct in the client number only).

Is there some easy way to do this ? A First function would have been ideal

The only thing I can get working is to use an inner select statement
using min (A.Number) - except that it takes 6 minutes instead of 6
seconds - which is a tad too slow.

Can I use a stored procedure to do this ? bearing in mind that the
where clause cant be hardcoded in the sp.