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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Syntax Problem "is null"

Status
Not open for further replies.

kenhutchings

Programmer
Jan 11, 2005
32
GB
Ok peeps here we go

This is the code from my sproc

SELECT TOP 100 PERCENT Business, COUNT(*) AS BCounter
FROM dbo.tblCoreData
WHERE (Mailed is null)
GROUP BY Business
ORDER BY Business

What it is supposed to do is Give be a list of all the Business Types (Business) and the count (Bcounter) in the table that have not got anything in the Mailed Column

But I just get every record in the table counted...

Any suggestions?
 
All Mailed values in table are NULL?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
No out of 32000 records 5028 of them have a '1' in the Mailed Column
 
Why the TOP 100 PERCENT?

And maybe the Mailed field does not contain NULL but maybe ''?
 
ummm top 100 Percent - no idea - ive removed it now and every record (excenpt those containg '1' and any new records have <NULL> in the Mailed column
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top