Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AND OR Statement

Status
Not open for further replies.

Khanson82

MIS
Joined
Mar 5, 2010
Messages
85
Location
US
I have this below..It is supposed to bring back a total of 3 for the count zip field. If you just use the getdate and statement, you get a total of 2 due to one of the fields being blank. If you use both the "and" and "or" you get 4???


SELECT a.ClientName AS Client, b.Zip AS ZipCode, COUNT(b.Zip) AS Zip
FROM dbo.Acc AS a INNER JOIN
dbo.vwa0 AS b WITH (nolock) ON a.ClientID = b.clientID
WHERE (b.StatusReason IN ('pending', 'reopen', 'reschedule', 'spanish pending'))
AND b.fudt <= getdate()
OR b.fudt = ('')


GROUP BY a.ClientName, b.Zip
 
Sorry guys, Just figured this one out.. No need to reply..
 
Post your solution; it may help others.



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
To fix my above problem, I put:

OR b.fudt is null

in place of :

OR b.fudt = ('')

And it worked great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top