mysql查询distinct和sum

时间:2011-03-09 06:07:23

标签: php mysql sql

我有一个像这样的mysql字段:

url_id     time_spent
-------    ----------
120         14
120         97  
120         14
120         97 

我想基于url_id(DISTINCT)仅显示14和97。

2 个答案:

答案 0 :(得分:2)

select * from table group by url_id,time_spent

答案 1 :(得分:1)

SELECT DISTINCT a.url_id, a.time_spent FROM table a