In my Table data are like below format.========= ========= ========= ============Client ID Ticker ID Broker ID Receive Time========= ========= ========= ============A T1 M1 5/22/2014 9:40A T1 M2 5/23/2014 11:40A T1 M3 5/24/2014 9:40A T2 M4 5/25/2014 7:40B T1 M1 5/26/2014 9:10B T1 M2 5/27/2014 0:40B T2 M3 5/28/2014 18:40I need output between datetime field as Client ID Ticker ID Broker ID Receive Time========= ========= ========= ============A T1 M2,M3A T2 M4B T1 M1,M2using below query I got result but not based on timeSELECT [Client ID], [Ticker ID], STUFF( (SELECT ',' + [Broker ID] FROM [Intrabase].[dbo].[ModelList] WHERE [Client ID] = a.[Client ID] and [Ticker ID] = a.[Ticker ID] FOR XML PATH ('')) , 1, 1, '') AS BrokerListFROM [Intrabase].[dbo].[ModelList] AS aGROUP BY [Client ID],[Ticker ID]
please suggest me how can i get output.