聯表查詢:blog
SELECT t1.user_Name FROM t_user AS t1 , t_comment AS t2 WHERE t2.user_id=t1.id im
結果如圖:查詢
加上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)img
如圖:co
GROUP BY的做用很明顯了吧ps
-----------------------------------------index
更新:
UPDATE t_comment SET state =1
UPDATE t_article SET index_state = 0 WHERE id <= 50
刪除表的某一列:
ALTER TABLE t_article DROP COLUMN index_state;