0

I want to get only 1 row from the number of duplicate aspect_id(rows) returned.

SELECT rt.taxonomy_id,rt.iteration,ra.* FROM request_taxonomy rt 
inner join request_aspects ra ON ra.aspect_id = rt.request_aspects_id
                WHERE rt.requests_id = 6 and ra.section_name='Timeline'; 

Is there any way to get the distinct rows based on aspect_id?

1
  • GROUP BY can help you Commented Oct 28, 2015 at 7:50

2 Answers 2

1

Use GROUP BY:

SELECT 
    rt.taxonomy_id,rt.iteration,ra.* 
FROM request_taxonomy rt 
        inner join request_aspects ra ON ra.aspect_id = rt.request_aspects_id
WHERE rt.requests_id = 6 and ra.section_name='Timeline'
GROUP BY aspect_id;
Sign up to request clarification or add additional context in comments.

Comments

1

GROUP BY can help you

SELECT rt.taxonomy_id,rt.iteration,ra.* 
FROM request_taxonomy rt 
inner join request_aspects ra ON ra.aspect_id = rt.request_aspects_id
WHERE rt.requests_id = 6 and ra.section_name='Timeline' 
GROUP BY aspect_id;

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.