Skip to content

Tag: sql

How to use IS NOT NULL on a case when?

I have the below SQL query in SSMS where I want to exclude NULL rows that show up in the ‘intercompany budget’ columns. I’ve tried to search for answers and putting a WHERE clause for ‘Intercompany Budget’ IS NOT NULL, like in the query below, but NULL rows still show up. Any sug…

How to compare counts from subselect?

I want to compare the count between two tables. Or more to say, output if the count from table1 is greater than from table2: SELECT c1 > c2 FROM (SELECT count(*) from table1) as c1, (SELECT count(*)…