General discussion

Locked

difficult SQL query

By estein ·
I want to do a query on 3 tables. In the example below if there is more then 1 record in Table2 linked to T1 then multiple rows are returned for each table 1.

SELECT T1.MT_ID, T2.FULL_NAME

FROM Table1 T1
LEFT JOIN Table2 T2

ON T1.MT_ID = T2.MP_MT_ID AND T2.ISActive = 'T'

i.e.

1 Joe Dunkin
1 John Milken
1 Robert Johnson
2 Null
3 Jen Berger


I would like to use a query that returns only one row fro each record in Table1 and concatenates the Full Names if more then on exists.

i.e.

1 Joe Dunkin, John Milken, Robert Johnson
2 Null
3 Jen Berger

Etc.

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Software Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums