return 1 row of data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do you return only 1 row of data on each of the duplicates?

e.g.

select tab1.col1, tab2.col2, tab2.col3
from tab1 left join tab2 on tab1.col1 tab2.col1

this query produces mutiple rows as tab2.col1 is not unique.

I just want the "first duplicate" instead of all the duplicates.

Thanks,

JB
 
Try using the DISTINCT keyword

SELECT DISTINCT tab1.col1, tab2.col2, tab2.col3
FROM tab1 left join tab2 on tab1.col1 = tab2.col1

This query will NOT be updatable
 
Thanks mate!


John Spencer said:
Try using the DISTINCT keyword

SELECT DISTINCT tab1.col1, tab2.col2, tab2.col3
FROM tab1 left join tab2 on tab1.col1 = tab2.col1

This query will NOT be updatable
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top