Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have 4 columns sometimes all 4 columns is 0,how i can remove this line from resultsThanks
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2013-01-25 : 14:13:38
You have to use a WHERE clause like shown below:
WHERE col1=0 AND col2=0 AND col3=0 AND col4=0;
nord
Posting Yak Master
126 Posts
Posted - 2013-01-25 : 14:26:36
ISNULL(credit_complet_qty and credit_complet_amt and diff_arrivage_qty and diff_arrivage_amt)I can write like that but doesnt work
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2013-01-25 : 14:50:16
Can you try one of these
-- eliminate if all are nullsWHERE COALESCE(col1,col2,col3,col4) IS NOT NULL;-- eliminate if it is a combination of nulls and zeros WHERE COALESCE(NULLIF(col1,0),NULLIF(col2,0),NULLIF(col3,0),NULLIF(col4,0)) IS NOT NULL;
nord
Posting Yak Master
126 Posts
Posted - 2013-01-25 : 15:16:22
Thanks a lot second one its work!!!!!!!!!!!!!!!!!!!!