0

hello,

I have a simple problem. I need to create a new table "smaller" using the data from an old table "larger" table. When I say smaller I mean it will have the exact structure as the older table but will have only a few records.

Now, i know that i can use:

CREATE TABLE new_table_name SELECT * FROM old_table_name WHERE id >= 1 AND id <= 5;"

but the problem is that i want to SELECT multiple sets of records. So in the example above I select WHERE id>= 1 AND id <=5 but say I also want to have id >= 10 AND id <=15 would I just do this:

CREATE TABLE new_table_name SELECT * FROM old_table_name WHERE (id >= 1 AND id <= 5) (id >= 10 AND id <= 15);"

I am using php. The usr decides what records are to be added into the new table and they are given multiple input text fields for each starting id and finishing id. I want to be able to do this with one query!

User input interface:
New Table Name : _______________
Starting ID : ___ , ___ , ___ , ___ , ___
Finishing ID : ___ , ___ , ___ , ___ , ___

Thanks for your help.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.