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
 General SQL Server Forums
 New to SQL Server Programming
 how to simply join cols together?

Author  Topic 

jeff06
Posting Yak Master

166 Posts

Posted - 2007-06-05 : 12:00:30
I have about 30 tabs with same struture.
I want to simple put column 2 in all 30 table in a new table without joining on anything. Is there a way to do that?
Thanks
JP

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-06-05 : 12:02:06
"I have about 30 tabs with same struture"
Then you need to redisign your database.
"I want to simple put column 2 in all 30 table in a new table without joining on anything."
Nope. Not happening without a join. Try following the links in my sig for more in depth help.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-06-05 : 12:18:38
Sounds like you don't want a JOIN, but a UNION... Also, it sounds like you probably have a really bad design.

example:

select col
from table1

union all

select col
from table2

union all

select col
from table3

....

union all

select col
from tableN



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-06-05 : 12:21:55
It sounded to me like he wants to try and normalize his tables. Either way, still sounded like a horrific design. Kind of like the dbs i use here at work

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -