Using the sql script below, I have over 50,000 records in the result set of which over 30,000 records only display "NULL" in seven columns; GT#_Identifier, Inspector_Name, Ancillary, Geography, Sequence, OverConsult, List.
My objective: Filter out all records that have a "NULL" in the above-mentioned seven columns.
What revisions to the sql script will allow the filtering out of all records that have a "NULL" in the seven fields?
Not yet able to resolve this and appreciate any insight.
I encounter the following errors;
Errors using Option 1:
Error using Option 2:
My objective: Filter out all records that have a "NULL" in the above-mentioned seven columns.
What revisions to the sql script will allow the filtering out of all records that have a "NULL" in the seven fields?
Not yet able to resolve this and appreciate any insight.
I encounter the following errors;
Errors using Option 1:
Code:
Incorrect syntax near the keyword 'is' and the red underline underneath "m.mcase" with the message 'the multi-part identifier "m.mcase" could not be bound"
Error using Option 2:
Code:
Option 2: Incorrect syntax near the key word 'is'.
Code:
Use test_db
SELECT DISTINCT
m.mcustomer,
clname1,
m.mcase,
m.mdesc1,
(select a.value from global a where a.globalindex = '101' and a.Gljoin = m.mcase and a.udtype = 'GT') Invoice_no,
(select a.value from global a where a.globalindex = '25' and a.Gljoin = m.mcase and a.udtype = 'GT') GT#_Identifier,
(select a.value from global a where a.globalindex = '42' and a.Gljoin = m.mcase and a.udtype = 'GT') Inspector_Name,
(select a.value from global a where a.globalindex = '125' and a.Gljoin = m.mcase and a.udtype = 'GT') Ancillary,
(select a.value from global a where a.globalindex = '130' and a.Gljoin = m.mcase and a.udtype = 'GT') Geography,
(select a.value from global a where a.globalindex = '160' and a.Gljoin = m.mcase and a.udtype = 'GT') Sequence,
(select a.value from global a where a.globalindex = '200' and a.Gljoin = m.mcase and a.udtype = 'GT') OverConsult,
(select a.value from global a where a.globalindex = '250' and a.Gljoin = m.mcase and a.udtype = 'GT') List,
(select a.value from global a where a.globalindex = '185' and a.Gljoin = m.mcase and a.udtype = 'GT') Append
FROM case m
inner join customer on m.mcustomer = clnum
inner join employee h on h.id = SupCon
inner join employee i on i.id = OrgCon
inner join employee b on b.id = BillCon
left outer join description mm on mm.mcase = m.mcase and mm.line=1
left outer join description mn on mn.mcase = m.mcase and mn.line=2
left outer join description mo on mo.mcase = m.mcase and mo.line=3
left outer join description mp on mp.mcase = m.mcase and mp.line=4
--Option 1
WHERE
mcustomer = '14258'
AND m.mclosedt is null
and (select a.value from global a where a.globalindex = '25' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --GT#_Identifier,
and (select a.value from global a where a.globalindex = '42' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --Inspector_Name,
and (select a.value from global a where a.globalindex = '125' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --Ancillary,
and (select a.value from global a where a.globalindex = '130' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --Geography,
and (select a.value from global a where a.globalindex = '160' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --Sequence,
and (select a.value from global a where a.globalindex = '200' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --OverConsult,
and (select a.value from global a where a.globalindex = '250' and a.Gljoin = m.mcase and a.udtype = 'GT') is not null, --List,
--Option 2
WHERE
mcustomer = '14258'
AND m.mclosedt is null
and (select a.value from global a where (a.globalindex in ('25', '42', '125', '130', '160', '200', '250')
and a.Gljoin = m.mcase and a.udtype = 'GT') is not null