MySQL Forums
Forum List  »  MySQL Query Browser

Remove duplicate data from one to many relation select query
Posted by: todaisies mysql
Date: February 06, 2012 10:16PM

Hello,

If i have 2 tables one header and one detail table like
table1
ID Code
1 X
Table2
Id Name
1 a
1 b
1 c

if i write a query "Select B.ID,B.Name,A.ID,A.Code from table1 A inner join Table2 B on A.Id=B.ID " the result would be like

1 a 1 X
1 b 1 X
1 c 1 X

How can i write a query to return data like this
1 a 1 X
1 b
1 c

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Remove duplicate data from one to many relation select query
February 06, 2012 10:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.