Hi all,

I have a funny requirement... I think it involves some specific type of
join, but I'm not sure which type. I have a clients table, and a support
incidents table that uses the clients table primary key as a foreign
key. I want to select all the clients for a drop down box, but have the
10 that have most recently had a support record logged appear at the
top. To complicate matters further, not all client records will have
support incidents logged against them, but I need all of the client to
appear in the recordset.

Disregarding the top 10 requirement until later, I have this so far:

select distinct clients.ID, clients.name, support.dated
from clients, support
where support.clientID = clients.ID
order by support.dated, clients.name

But this is not selecting distinct records - If a certain client has had
five support incidents, that client will appear five times. It's also
not showing clients that don't have any support incidents logged.

Argh.... Can anyone point me in the right direction? SQL Server 2K by
the way.

Thanks,
Kay.
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to