Oracle
 sql >> Database >  >> RDS >> Oracle

Oracle SQL:come restituire più colonne distinte

Prova questo

 SELECT MIN(I.INCIDENTID)               AS "Incident ID",
        I.CREATIONDATE                  AS "Creation Date",
        MO.IPADDRESS                    AS "IP Address",
        MO.DOMAINUSERNAME               AS "Login ID",
        MO.ENDPOINTMACHINENAME          AS "Computer Name",
        M.MESSAGESUBJECT                AS "Email Subject"
   FROM MESSAGE M,
        INCIDENT I,
        MESSAGEORIGINATOR MO
  WHERE M.MESSAGESOURCE = 'ENDPOINT'
    AND M.MESSAGESOURCE = I.MESSAGESOURCE
    AND M.MESSAGEID = I.MESSAGEID
    AND M.MESSAGEDATE = I.MESSAGEDATE 
    AND M.MESSAGEORIGINATORID = MO.MESSAGEORIGINATORID 
    AND I.ISDELETED = 0
  GROUP BY I.CREATIONDATE, MO.IPADDRESS, MO.DOMAINUSERNAME, MO.ENDPOINTMACHINENAME,M.MESSAGESUBJECT