Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select max(field1),max(field2),max(field3),...
- from series where t_stamp between x and y
- SELECT
- CASE WHEN EXISTS (SELECT * FROM Series WHERE t_stamp BETWEEN @x AND @y AND field1 IS NOT NULL) THEN 1 ELSE 0 END AS field1,
- CASE WHEN EXISTS (SELECT * FROM Series WHERE t_stamp BETWEEN @x AND @y AND field2 IS NOT NULL) THEN 1 ELSE 0 END AS field2,
- ...
- create table series (fieldno integer, t_stamp date);
- select distinct fieldno from series where t_stamp between x and y;
- select 'field1' as fieldname from series
- where field1 is not null and t_stamp between x and y
- UNION
- select 'field2' from series where field2 is not null
- ... etc
- select count(field1),count(field2),count(field3),...
- from series where t_stamp between x and y
- SELECT CASE WHEN field1 IS NOT NULL THEN '' ELSE 'contains null' END AS field1_stat,
- CASE WHEN field2 IS NOT NULL THEN '' ELSE 'contains null' END AS field2_stat,
- ... for every field to be checked
- FROM series
- WHERE foo IN bar
- GROUP BY CASE WHEN field1 IS NOT NULL THEN '' ELSE 'contains null' END,
- CASE WHEN field2 IS NOT NULL THEN '' ELSE 'contains null' END
- ... etc
Add Comment
Please, Sign In to add comment