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

Ensure field values of SELECT exist

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
I have a large SELECT query along the lines of

SELECT aa,bb,cc,dd,ee,ff,gg
FROM tblA a
INNER JOIN tblB b ON a.FldA = b.FldB
....
WHERE a.FldA = 100


What is the best way of only selecting the values that are not NULL?
 
Values that are not null, what do you mean?

Do you mean you don't want to return any rows where one or more values are null? Then do something like
WHERE aa IS NOT NULL AND bb IS NOT NULL...

Or do you want to replace NULL with a specific value? The you can use COALESCE:
SELECT COALESCE(aa,'Somthing instead of NULL'), COALESCE(bb,...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top