Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select first servcie for a client

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-01-04 : 09:45:48
David writes "David writes "I have two tables, clients and services. I need to be able to list for each client the date they received their first service from us. The client_id is used in both tables and each client may have multiple services. I can find the first ever service, but how do I find the first service for each of the multiple clients in a single report?" "

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-01-04 : 10:47:19
SELECT client_id, min(servicedate)
FROM services
GROUP BY client_id
Go to Top of Page
   

- Advertisement -