I've tables and data as following,declare @tH table(idx int, employer int, statementNo varchar(20))insert into @tH values(2, 1, 'S0803/2011/11/1');insert into @tH values(3, 3, 'S0900/2011/11/1');/*idx is a primary keystatementNo is unique*/declare @tD table(idx int identity, tH_idx int, chequeNo varchar(20), amt decimal(10,2))insert into @tD(tH_idx, chequeNo, amt) values(2, '19254474', 1000.00);insert into @tD(tH_idx, chequeNo, amt) values(2, '19254475', 180.00);insert into @tD(tH_idx, chequeNo, amt) values(3, '88488998', 2500);/*idx is a primary key with identityrelationship between @tH and @tD is 1 to manytH_idx is foreign key to @tH(idx)*/
if @tH(idx)=2, how to display output as following,idx | employer | statementNo | chequeNo | totalAmt----------------------------------------------------------------------------------------------2 1 S0803/2011/11/1 19254474,19254475 1180.00
if @tH(idx)=3, how to display output as following,idx | employer | statementNo | chequeNo | totalAmt----------------------------------------------------------------------------------------------3 3 S0900/2011/11/1 88488998 2500.00
really need help