聯表查詢: SELECT t1.user_Name FROM t_user AS t1 , t_comment AS t2 WHERE t2.user_id=t1.id 結果如圖: 加上GROUP BY user_name(SELECT t1.user_Name FROM t_user AS t1 ...
聯表查詢:
SELECT t1.user_Name FROM t_user AS t1 , t_comment AS t2 WHERE t2.user_id=t1.id
結果如圖:
加上GROUP BY user_name(SELECT t1.user_Name FROM t_user AS t1 , t_comment AS t2 WHERE t2.user_id=t1.id GROUP BY user_name)
如圖:
GROUP BY的作用很明顯了吧
-----------------------------------------
更新:
UPDATE t_comment SET state =1
UPDATE t_article SET index_state = 0 WHERE id <= 50
刪除表的某一列:
ALTER TABLE t_article DROP COLUMN index_state;