0

Trying to make query for 4 hours. For example i have such data:

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  

How to chose distinct title and distinct number_link ? I have marked with "<-" what i want to get from query. Thanks in advance.

1
  • 3
    can you show us what you have tried in 4 hrs? Commented Sep 26, 2013 at 11:35

4 Answers 4

1

This query will allows you to get all the column with in the row not just title and 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
Sign up to request clarification or add additional context in comments.

Comments

0
SELECT title FROM table GROUP BY title, number_link

Comments

0

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

Comments

0
SELECT *
FROM table_name
GROUP BY title, number_link

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.