sql查詢某欄位的相同值:
SELECT * FROM table WHERE col in (SELECT col FROM table GROUP BY col HAVING COUNT (col) >1);
順帶說一下where和having:
#select * from table
where ···(只能對分組前的屬性進行篩選)
group by ···(按某個欄位分組)
having ···(只能將分組後的每個群組的整體屬性進行篩選,以聚合函數體現)
--不使用group by就預設表的整體為一組
以上是sql查詢某欄位的相同值的詳細內容。更多資訊請關注PHP中文網其他相關文章!