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 |
|
PeterG
Posting Yak Master
156 Posts |
Posted - 2003-03-11 : 12:50:19
|
| I have the following query where I'm selecting cardholders that did not have activity during the selected date range. I don't know how to do the where part of the clause. Pls help me.SELECT DISTINCT CardHolder.Name, CardHolder.AccountNumber, TransDetail.TransDateFROM CardHolder INNER JOIN TransDetail ON CardHolder.AccountNumber = TransDetail.AccountNumber INNER JOIN TransDist ON TransDetail.ID = TransDist.TransID--WHERE TransDetail.TransDate BETWEEN '1/1/2001' AND '1/31/2001'ORDER BY Cardholder.Name |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-03-11 : 13:11:14
|
I think you want something like (psuedo-sql)select cardholderfrom dataset dwhere not exists ( select cardholder from dataset where d.cardholder = cardholder and transaction between start and end ) Be careful with your start and end as the time portion of the datetime will default to 0:00:00.000 if not specified. ArnoldFribble can tell you more about that ...Jay White{0}Edited by - Page47 on 03/11/2003 13:12:28 |
 |
|
|
|
|
|