Creating two temp tables did the trick. Thanks :)
-----Original Message-----
From: Jim Dorame [mailto:[Email Address Removed]
Sent: May 30, 2003 11:28 AM
To: aaron
I'm confused from you snippet there is no a,b,c in table 1.
Here is a snippet of code to try, if you have a field to join on it will
simplify matters.
If you can you can create temp tables with an identity column and then load
the data in to the temp tables in the order that they need to be then just
join them. Not sure if this helps you but...
Create Table #T1(PKID int identity (1,1),
Field1 char(10),
Field2 char(10),
Field3 char(10))
Create Table #T2(PKID int identity (1,1),
Field4 char(10),
Field5 char(10),
Field6 char(10))
Insert #T1 (Field1,Field2,Field3)
SELECT 'A','B','C'
Insert #T2 (Field4,Field5,Field6)
SELECT 'AA','BB','CC'
Select Field1,Field2,Field3,Field4,Field5,Field6
FROM #T1
JOIN #T2
ON #T1.PkID = #T2.PkID
-----Original Message-----
From: aaron [mailto:[Email Address Removed] Friday, May 30, 2003 10:14 AM
To: 'Jim Dorame'
Subject: RE: Combine two statements ...
I am not sure I follow ...
I am looking to replace a, b, c from tbl_2 with a, b, c from tbl_1 in order
to create new records...
-----Original Message-----
From: Jim Dorame [mailto:[Email Address Removed] May 30, 2003 11:08 AM
To: aaron
What about using place holders for the second table fields in the first
select?
-----Original Message-----
From: aaron [mailto:[Email Address Removed] Friday, May 30, 2003 10:04 AM
To: LazyDBA.com Discussion
Subject: Combine two statements ...
How can I combine two select statements that do not have an equal number of
expressions???
Select a, b, c from tbl_1
Union
Select x, y, z, aa, bb, cc, dd from tbl_2
Then.. The desired results would be:
A, b, c, x, y, z, aa, bb, cc, dd
:)
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To
unsubscribe, e-mail: mssqldba-[Email Address Removed] For additional
commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page