我无法理解我的问题。我有这样的数据库。
ID | Offense | Remarks
003 No Id Community service
020 No Id Community service
012 No Id Community service
003 No Id Community service
003 Not in proper uniform Community service
现在我想用“003”这样的ID显示进攻。我希望用HTML这样显示它。
ID Offense Remarks
003 No ID Community Service
003 not in proper uniform Community Service.
答案 0 :(得分:1)
SELECT * FROM <table> GROUP BY ID, Offense;
答案 1 :(得分:1)
使用DISTINCT
:
SELECT DISTINCT FROM ....
http://dev.mysql.com/doc/refman/5.0/en/select.html
DISTINCT指定从结果集中删除重复的行。
答案 2 :(得分:1)
SQL Query将是:
SELECT ID, DISTINCT Offense, Remarks FROM youtable WHERE ID = '03'