|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
populating a table with the results of a SQL query
Is there any way i could take the first 50 results of a sql query and store them into 1 table in access and take the next 50 and store them into a second table in access? Is there any SQL statement that will direct where the output gets directed
to? OR is there a way to have the sql reults paird up with a autonumbered ID? Doc |
|
#2
|
|||
|
|||
|
RE: Top 50
Does your primary table have a Primary Key that is autonumbered? If so then you can use a between statement for your select.
Code:
INSERT INTO t_myoutput_table1 (id,firstname,lastname) VALUES(SELECT id,firstname,lastname FROM t_mytable WHERE id BETWEEN 1 AND 50) or Code:
INSERT INTO t_myoutput_table2 (id,firstname,lastname) VALUES(SELECT id,firstname,lastname FROM t_mytable WHERE id BETWEEN 51 AND 100) -Travis |
|
#3
|
|||
|
|||
|
Ok A bit confused, As of now I have 1 query that returns 100+ results. I have 2 auto numbered tables ready to accept data Table1, Table2. How do you implement the code you provided to get my data from the query to the 2 tables? And what is mytable? If you are assuming that i have 1 big auto numbered table with all the query results in it, Im not that far yet, if you know how to get to that step please let me know!
Thx |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > populating a table with the results of a SQL query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|