Skip to content

Commit 62cf397

Browse files
committed
Guard against null data in query
1 parent 5e70ecf commit 62cf397

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mcc/resources/queries/mcc/mccPedigree.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ SELECT
3232
null as originalSire,
3333
'Added' as category
3434
FROM mcc.aggregatedDemographics s
35-
WHERE s.sire NOT IN (SELECT distinct Id FROM mcc.aggregatedDemographics)
35+
WHERE s.sire IS NOT NULL AND s.sire NOT IN (SELECT distinct ad.Id FROM mcc.aggregatedDemographics ad WHERE ad.Id IS NOT NULL)
3636
GROUP BY s.sire
3737

3838
UNION ALL
@@ -51,5 +51,5 @@ SELECT
5151
null as originalSire,
5252
'Added' as category
5353
FROM mcc.aggregatedDemographics s
54-
WHERE s.dam NOT IN (SELECT distinct Id FROM mcc.aggregatedDemographics)
54+
WHERE s.dam IS NOT NULL AND s.dam NOT IN (SELECT distinct ad.Id FROM mcc.aggregatedDemographics ad WHERE ad.Id IS NOT NULL)
5555
GROUP BY s.dam

0 commit comments

Comments
 (0)