Matric No Name Supervisor Name Section 0924564 Nur Hidayah Mohammad Daud |Che Siti Fatimah Che Hasan 1 1017951 Nur Akmal Hakeem Zainal Abidin |Ali 2 1017164 Qurratu 'Aini Zaini |PHONE MYINT NAING 3 23 Eshrak |Ali 2
这基本上就是表格中的内容。如何获取具有相同主管的学生排? 提前谢谢。
答案 0 :(得分:0)
你必须这样
SELECT a.*
FROM TableName a
INNER JOIN
(
SELECT Supervisor Name
FROM TableName
GROUP BY Supervisor Name
HAVING COUNT(*) > 1
) b ON a.Supervisor Name= b.Supervisor Name
答案 1 :(得分:0)
如果您只有一张桌子,那么您可以试试这个:
SELECT DISTINCT(Supervisor Name),Matric No,Name,Section FROM table_name
答案 2 :(得分:0)
SELECT
Matric_No,
Name,
Supervisor_Name,
Section,
count(Section) as Total
FROM mytable
GROUP BY Section
Having Total > 1