很久不用就忘記了,兩個月前還特地的去請教同事。好記性不如爛文檔呀,這裏記錄一下吧!sql
SELECT count(*) AS num, STR_COL1 FROM pub_data_import AS c WHERE -- 過濾查詢 c.IMPORT_NUM = '219692e2-150b-4aba-ad78-3410ca50e878' GROUP BY -- 分組,能夠填寫不少... c.STR_COL1, c.str_col3 HAVING -- 過濾分組查詢 num > 1;
渣渣的我,之前的功課全還給老師了。函數
count(*) 能夠換成相關的函數,sum,arg...spa
記住註釋裏面的意思,之後碰上這類問題,輕鬆解決。code