Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bpgupta
Yak Posting Veteran
75 Posts |
Posted - 2007-08-01 : 05:50:41
|
Hi,I am using sql 2000 and i need to show the records in some fashion,Now query is giving two records ,but i have to show the records in one rowCREATE TABLE [dbo].[TblMessageTo] ( [MesTO_ID] [int] IDENTITY (1, 1) NOT NULL , [MesTo_Mes_ID] [int] NOT NULL , [MesTo_User_ID] [int] NOT NULL , [MesTo_User_Id_To] [int] NULL , [MesTo_Email_Id_To] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [MesTo_IsActive] [bit] NOT NULL ) ON [PRIMARY]GOMesTO_ID MesTo_Mes_ID MesTo_User_ID MesTo_User_Id_To MesTo_Email_Id_To55 46 25 25 NULL 156 46 25 1 NULL 1select MesTo_User_Id_To from tblmessageto where mesto_mes_id =46The above query is showing two records , but i have to show in one record.I need to show the mesto_USer_Id_To to one rows,So it should come like 25,1 or 1,25Regards,BPG |
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-08-01 : 06:38:22
|
declare @mesto_USer_Id_To varchar(50)Select @mesto_USer_Id_To = Isnull(cast(@mesto_USer_Id_To as varchar(50))+',','') + mesto_USer_Id_To from mesto_mes_id =46Select @mesto_USer_Id_To--------------------------------------------------S.Ahamed |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-01 : 07:10:29
|
If you want to show the data in front end application, you can easily do concatenation thereMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|