May 12, 2006 at 4:00 am
Hi Guys,
Is this possible??????????
create table #temp1(T1 INT)
create table #temp2(T2 INT)
insert into #temp1 values(300)
insert into #temp2 values(600)
insert into #temp1 values(400)
insert into #temp2 values(700)
I created two temp table, in this two table there is no relation but i need to display record like this.
T1 T2
- - - - - - -
100 200
300 600
I have tried every single thing I know but did not succeed. what will be query?
Thanks
Brij
May 12, 2006 at 4:14 am
Please describe how to get from your sample data to your required results. Where did the 100 and 200 come from?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
May 12, 2006 at 4:40 am
Sorry the output I want is:::
T1 T2
- - - - - - -
300 600
400 700
Brij
May 12, 2006 at 4:44 am
OK - so what is the relationship between T1 and T2? Do you just want them displayed side-by-side in ascending order?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
May 12, 2006 at 5:31 am
There is no relationship between T1 and T2. T1 is column in Table1 and T2 is column in Table2.
Yes I want to display the data side-by-side. Is this possible?
Brij
May 12, 2006 at 7:30 am
SELECT MAX(T1),MAX(T2)
FROM (SELECT t1.T1 AS [T1],null AS [T2],(SELECT COUNT(*) FROM @temp1 a WHERE a.T1 <= t1.T1) AS [ID]
FROM @temp1 t1
UNION
SELECT null AS [T1],t2.T2 AS [T2],(SELECT COUNT(*) FROM @temp2 b WHERE b.T2 <= t2.T2) AS [ID]
FROM @temp2 t2) x
GROUP BY [ID]
ORDER BY [ID]
Far away is close at hand in the images of elsewhere.
Anon.
May 12, 2006 at 7:35 am
Thanks David!!! this is awesome. Really helps...
Brij
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply