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.
| Author |
Topic |
|
Detox
Starting Member
1 Post |
Posted - 2012-01-04 : 15:50:25
|
| Hello All!I would like to "polish" a query I made. It searches for appointments that have not happened in the past 60 days. It would really be great to also show the last appointment kept. Here is the code i am using now:SELECT cg.gruppe_name, cg.crecordnumber, cg.client_name, cg.reason, n.date_service FROM client_gruppe cgLEFT JOIN notes n ON cg.crecordnumber = n.crecordnumber AND DATE(n.date_service) >= NOW() -60WHERE cg.gruppe_name <>'ZAPPED' AND n.crecordnumber IS NULLIt asks for all clients except those in a group named ZAPPED. The date of the appointment is n.date_service.I do not know how I can search for people who have not been here in past 60 days, but show the last time they were actually here.Is there a way to do this? Thanks for any suggestions |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-01-04 : 17:01:13
|
| http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|