July 22, 2010 at 11:49 am
How to create sql table using a below select statement(4 tables)
select T1.column1,T1.column2, T3.column3, T2.column4,
t2.column5,T1.column6, T3.column7, T4.column8
from table1 T1, table2 T2, table3 T3, table4 T4
WHERE T1.column1 = T2.column1 AND t1.column2 =T3.column2
AND T3.column7 = T4.column7 AND T3.Accountid =1
Please advice
July 30, 2010 at 9:10 am
Hi,I think you could use select... into ... because your column names are all unique. Something like this.
select
T1.column1,
T1.column2,
T3.column3,
T2.column4,
t2.column5,
T1.column6,
T3.column7,
T4.column8
into
NewTable
from
table1 T1, table2 T2, table3 T3, table4 T4
WHERE
T1.column1 = T2.column1
AND t1.column2 = T3.column2
AND T3.column7 = T4.column7
AND T3.Accountid =1
NB
1 not tested
2 join syntax is old style, its easier to read if the JOIN is split out from the WHERE
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy