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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query

Author  Topic 

swatib
Posting Yak Master

173 Posts

Posted - 2007-07-02 : 04:58:58
HI All,

i have a table in which there are 2 records each time:

From Date, To Date, Type, dataindentified, dataocuured
1-jul-07,2-jul-07,A,45,30
1-jul-07,2-jul-07,B,12,11

I want the result of query as follow:
From Date, To Date, Type, dataindentified, dataocuured,Type, dataindentified, dataocuured
1-jul-07,2-jul-07,A,45,30,B,12,11

Result should be a single row. please help me.





Njoy Life

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-02 : 05:05:57
what is the Primary Key of this table ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Ifor
Aged Yak Warrior

700 Posts

Posted - 2007-07-02 : 06:07:12
Maybe something like:
SELECT T1.FromDate, T1.ToDate
,T1.Type, T1.dataidentified, T1,dataoccurred
,T2.Type, T2.dataidentified, T2,dataoccurred
FROM YourTable T1
JOIN YourTable T2
ON T1.FromDate = T2.FromDate
AND T1.ToDate = T2.ToDate
AND T1.Type < T2.Type

Go to Top of Page

johnsql
Posting Yak Master

161 Posts

Posted - 2007-10-26 : 11:21:17
quote:
Originally posted by Ifor

Maybe something like:
SELECT T1.FromDate, T1.ToDate
,T1.Type, T1.dataidentified, T1,dataoccurred
,T2.Type, T2.dataidentified, T2,dataoccurred
FROM YourTable T1
JOIN YourTable T2
ON T1.FromDate = T2.FromDate
AND T1.ToDate = T2.ToDate
AND T1.Type < T2.Type





This is far away from OP's request.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-29 : 03:24:26
quote:
Originally posted by swatib

HI All,

i have a table in which there are 2 records each time:

From Date, To Date, Type, dataindentified, dataocuured
1-jul-07,2-jul-07,A,45,30
1-jul-07,2-jul-07,B,12,11

I want the result of query as follow:
From Date, To Date, Type, dataindentified, dataocuured,Type, dataindentified, dataocuured
1-jul-07,2-jul-07,A,45,30,B,12,11

Result should be a single row. please help me.





Njoy Life


Where do you want to show the data?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -