联表查询:
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;