Skip to Content
0
Nov 23, 2021 at 10:42 PM

query and alert based on query displaying different results

119 Views

i have created a query which runs fine.

now i want to set up an alert so the results of the query are emailed to me each week but the query results are different.

the result shows repetitive data, not distinct data as the query specifies.

the query only results in 14 lines of data when generated from the query manager but shows each bp many times when run from the alert.

here is my query:

SELECT DISTINCT T1.[CardCode], T1.[CardName], T1.[ValidComm]

FROM ORDR T0

INNER JOIN OCRD T1 ON T0.[CardCode] = T1.[CardCode]

INNER JOIN OSLP T2 ON T1.SlpCode = T2.SlpCode

WHERE T1.[frozenFor] = 'n'

and T1.[CardType] = 'c'

and t1.CardCode not in (select distinct t0.CardCode from ORDR T0 where T0.DocDate > dateadd(day,-30,getdate()))

and T2.[SlpName] = 'carole richardson'

Thanks a lot