Have been working on this the whole day.
Following query returns around 162,000 records. Handful of them are duplicates.
Really, I'm not sure how else to troubleshoot.
This database pulls from external database for which I only have READ Access.
For example, if I have two rows
20684 2/26/2019 11:13:04 AM abra 123 abc 6 abra
20690 2/26/2019 11:13:04 AM abra 123 abc 6 abra
I would like to keep 20684 abra 123 abc 6 abra
20684 is the unique
I.INCIDENTIDthat is not included in
GROUP BY`
Please assist.
SELECT TO_CHAR(MIN(I.INCIDENTID)) AS "Incident ID",
I.CREATIONDATE AS "Creation Date",
M.MESSAGESUBJECT AS "Email Subject",
MO.IPADDRESS AS "IP Address",
MO.DOMAINUSERNAME AS "Login ID",
MO.ENDPOINTMACHINENAME AS "Computer Name"
FROM MESSAGE M
LEFT JOIN INCIDENT I
ON M.MESSAGESOURCE = I.MESSAGESOURCE
AND M.MESSAGEID = I.MESSAGEID
AND M.MESSAGEDATE = I.MESSAGEDATE
LEFT JOIN MESSAGEORIGINATOR MO
ON M.MESSAGEORIGINATORID = MO.MESSAGEORIGINATORID
LEFT JOIN MESSAGEEXT ME
ON ME.MESSAGEID = M.MESSAGEID
LEFT JOIN INCIDENTSTATUS S
ON S.INCIDENTSTATUSID = I.INCIDENTSTATUSID
LEFT JOIN CUSTOMATTRIBUTESRECORD C
ON C.CUSTOMATTRIBUTESRECORDID = I.CUSTOMATTRIBUTESRECORDID
GROUP BY I.CREATIONDATE,
M.MESSAGESUBJECT,
MO.IPADDRESS,
MO.DOMAINUSERNAME,
MO.ENDPOINTMACHINENAME
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…