尝试查询4小时。例如,我有这样的数据:
did title number_link ltitle
35 about.html 1 NULL <- this
35 about.html 2 NULL <- this
36 about.html 1 NULL
35 contact.php 1 NULL <- this
35 contact.php 3 NULL <- this
36 contact.php 1 NULL
如何选择不同的标题和不同的number_link? 我用“&lt; - ”标记了我想要查询的内容。 提前谢谢。
答案 0 :(得分:1)
此查询将允许您获取行中的所有列,而不仅仅是title
和number_link
。
SELECT a.*
FROM tableName a
INNER JOIN
(
SELECT title, number_link, MIN(did) did
FROM tableName
GROUP BY title, number_link
) b ON a.title = b.title AND
a.number_link = b.number_link AND
a.did = b.did
答案 1 :(得分:0)
SELECT title FROM table GROUP BY title, number_link
答案 2 :(得分:0)
SELECT *
FROM table_name
GROUP BY title, number_link
答案 3 :(得分:0)
SELECT title,number_link FROM table GROUP BY title,number_link;