0

尝试查询 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 ?我已经用“<-”标记了我想从查询中得到什么。提前致谢。

4

4 回答 4

1

此查询将允许您获取行中的所有列,而不仅仅是titleand 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
于 2013-09-26T11:38:17.963 回答
0
SELECT title FROM table GROUP BY title, number_link
于 2013-09-26T11:36:42.960 回答
0
SELECT *
FROM table_name
GROUP BY title, number_link
于 2013-09-26T11:46:07.627 回答
0

SELECT title,number_link FROM table GROUP BY title, number_link;

于 2013-09-26T12:02:17.987 回答