Monday, 16 November 2015

Difference Between NULLIF And NULL Using Count() Funtion in Sql

SELECT
COUNT(pkt) AS Pkt1,
COUNT(CASE WHEN Pkt = 0 THEN NULL ELSE Pkt END) AS Pkt2,
COUNT(CASE WHEN Pkt = 0 THEN 0 ELSE Pkt END) AS Pkt3,
COUNT(NULLIF(Pkt,0)) AS Pkt4
 FROM (SELECT 0 AS Pkt UNION ALL SELECT 1 AS Pkt UNION ALL SELECT 0 AS Pkt UNION ALL SELECT 2 AS Pkt ) AS P

No comments:

Post a Comment

Row based styling for Primeng DataTable using Angualr 2,4

------------------------------------Component.Html---------------- < p -dataTable id = "Tbl" [ rowStyleClass ]= " Fu...