sql查詢某字段的相同值
發(fā)表時(shí)間:2023-09-02 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]sql查詢某字段的相同值:
SELECT * FROM table WHERE col in (SELECT col FROM table GROUP BY col HAVING COUNT (col) >1);順帶說(shuō)一下where和having:
select * fr...
sql查詢某字段的相同值:
SELECT * FROM table WHERE col in (SELECT col FROM table GROUP?BY col HAVING COUNT (col)?>1);
?
順帶說(shuō)一下where和having:
select * from table
where ···(只能對(duì)分組前的屬性進(jìn)行篩選)
group by ···(按某個(gè)字段分組)
having ···(只能對(duì)分組后的每個(gè)組的整體屬性進(jìn)行篩選,用聚合函數(shù)體現(xiàn))
--不使用group by就默認(rèn)表的整體為一組
以上就是sql查詢某字段的相同值的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注php中文網(wǎng)其它相關(guān)文章!
學(xué)習(xí)教程快速掌握從入門到精通的SQL知識(shí)。