Mysql
 sql >> Database >  >> RDS >> Mysql

Query NON DISTINTA in MySQL

Nella descrizione della colonna della tabella dei risultati non vedo minit, address and number of occurrences . Pertanto semplificherei la tua selezione su:

SELECT e1.ninumber,
       e1.fname,
       e1.lname,
       e1.superNiNumber,
FROM   employee AS e1,
       employee AS e2
WHERE  e1.dno = 8
       AND e1.superNiNumber = e2.ninumber
       AND e2.dno = 8
       and (select count(*) from employee e3
            where e3.superNiNumber = e1.superNiNumber) > 1;