lab30tnd > 31-07-22, 08:16 PM
ongke0711 > 01-08-22, 06:08 PM
SELECT A.ID, Count(A.ID) AS CountOfID
FROM A
GROUP BY A.ID
HAVING Count(A.ID)>1;
SELECT A.ID, Count(A.ID) AS CountOfID
FROM A
GROUP BY A.ID
HAVING Count(A.ID)=1;
lab30tnd > 03-08-22, 02:07 PM
(01-08-22, 06:08 PM)ongke0711 Đã viết: Vụ này dùng Group By Query thôi. Ví dụ tên table là A
- Tìm ID trùng (>1)
Mã:SELECT A.ID, Count(A.ID) AS CountOfID
FROM A
GROUP BY A.ID
HAVING Count(A.ID)>1;
- Tìm ID không trùng: (=1)
Mã:SELECT A.ID, Count(A.ID) AS CountOfID
FROM A
GROUP BY A.ID
HAVING Count(A.ID)=1;
ongke0711 > 04-08-22, 08:06 PM
cpucloi > 06-08-22, 11:24 AM
lab30tnd > 06-08-22, 12:13 PM
tranthanhan1962 > 08-08-22, 07:59 PM