I have a large table with 30000+ rows. Most of the rows can be group by Column 1.
Say you had 10000 people and numbers 1 through 3. Every person would be linked to 1, 2 & 3. hence 30000 rows.
What i need to do is create a table for each number. i.e. Table 1 where column 1 is 1 (then it lists 10000 rows)
Table 2 where column 1 is 2 (another 10000 rows) and so on.
I need to create just under 300 tables. Is there a quicker way of doing that than this 300 times?
I'll try and put it into an example of what i'm looking for
Original table
Column 1 Column 2 Column 3 etc...-
1 a b .....
2 a b .....
1 c d .....
2 c d .....
AND THEN TURN IT INTO
Table name '1'
Column 1 Column 2 Column 3 etc...
-
1 a b .....
1 c d .....
Table name '2'
Column 1 Column 2 Column 3 etc...
-
2 a b .....
2 c d .....
Using one piece of code and the data in Column 1 as the table names?
Thanks
it worked like this
Select *into 1 from Original Table where column1 = 1
Select *into 2 from Original Table where column1 = 2
All i did was copy the column names into excell and duplicate the rest and run seperate select queries.
No comments:
Post a Comment