Is there any function to check if a column in a group contains NULL, or how can I solve it? An example below is a data structure.
id | value ---------- 1 | NULL 1 | 56 2 | 98 2 | 14
Result:
id | value ---------- 1 | 1 2 | 0
try
select id, count(*) - count(value) as null_value_count from your_table group by id
SQLFiddle demo
Another possibility that does not take advantage of the fact that count(value) ignores NULL values:
count(value)
NULL
select id, sum(case when value is null then 1 else 0 end) as null_count from your_table group by id;
Source: https://habr.com/ru/post/1437028/More articles:Andengine spinning image - androidCan I create a general list of a specific interface in Delphi? - genericsHow can I detect that an application is being deleted? - androidHow are multiple rows inserted with MySqlCommand and prepared for application? (# C) - c #Regex to remove interest - regexHow to fail a chain if its subtask throws an exception - pythonWCF add custom HTTP header to request - c #Java algorithm: writing a list of pairs according to several criteria - javaVery poor performance when using Glassfish 3.1.2 and Java EE + Hibernate - javaUnable to pass function link to form from frame - delphiAll Articles