Reputation: 292
I have two tables that is :
In theatre table there is one record with id 1, like :
1, Big Cinema, abc.
And in moive table there are 3 record like :
1) 1, Race, 1.
2) 2, BMB, 1.
3) 3, SOTY, 1.
Now I want to show theatre name only one time and with all three movie.
Upvotes: 1
Views: 98
Reputation: 408
If did you mean to concatinate some columns in one column you can try
Select t.tname + ' ' + t.taddress as tNameAdress, m.mname
from movie m inner join theatre t on m.tid = t.id
Upvotes: 0
Reputation: 11599
Is this what you need ?
select [id],[tname],
stuff((select ',' + CAST(t2.[mname] as varchar(10))
from movie t2 where t1.[id] = t2.[tid]
for xml path('')),1,1,'') SomeColumn
from theatre t1
group by [id],[tname]
Upvotes: 4