EDIT: I have written it a bit wrong gill change my Q
I'm a newbie with SQL and I have a Q..
I made 2 Temp. Tables. Each has 25 Rows.(DateValue)
I want to combine this 2 tables in a third table.. First Table is [From] Second Table is [To]... Both tables have different values
I want to get it like this:
From| To |
1111|2222
2222|3333
3333|4444
etc..
I use this simple Query
Create Table #T3
(
[From] Datetime
,[To] Datetime
)
INSERT Into #T3
SELECT Distinct #T1.[From], #T2.[To]
From #T1,#T2
Where #T1.[From] is not null
And #T2.[To] is not null
Select * from #T3
Drop Table #T3
Drop Table #T2
Drop Table #T1
But my results are like this
From| To |
1111|1111
1111|2222
1111|3333
2222|1111
2222|2222
2222|3333
It multiplies the first field with the second wich gives me alot more records back..
Any help ? THANKS !
Where #T1.[From] = #T2.[To]. And you probably don't need theDISTINCTat all.