473,480 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I save a query result to a new table?

4 New Member
I want to save a query result to a new table. Is this possible using sql commands? Like: Select Col1, Col2, Col7 from tbl1 Order by Col1 - Save it to tbl2 using the same column headers generated from the query?

Thanks!
Mar 30 '07 #1
2 12815
iburyak
1,017 Recognized Expert Top Contributor
If you want to save select statement into a new table which will be created on a fly do following:

[PHP]Select Col1, Col2, Col7 into tbl2 from tbl1 Order by Col1 [/PHP]

If you want to insert select statement into existing table do following:

[PHP]Insert into tbl2
Select Col1, Col2, Col7 from tbl1 Order by Col1 [/PHP]

Good Luck.
Mar 31 '07 #2
Merio
4 New Member
If you want to save select statement into a new table which will be created on a fly do following:

[PHP]Select Col1, Col2, Col7 into tbl2 from tbl1 Order by Col1 [/PHP]

If you want to insert select statement into existing table do following:

[PHP]Insert into tbl2
Select Col1, Col2, Col7 from tbl1 Order by Col1 [/PHP]

Good Luck.

---
It worked. Thanks a lot!
Apr 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
8547
by: Felix | last post by:
Hi, I've a problem: I want to have the result of my Mysql Query in a Table in my php file. Now I've this: <?
3
1931
by: Nick Truscott | last post by:
<? // scoreinput.php - input a match score when match selected from list ?> <html> <head> <basefont face="Verdana"> </head> <body>
7
3366
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
3
1944
by: cover | last post by:
I have a table with 50 fields that receive input depending on whether that input came in from a 'shaker' form or a 'conveyor' form. Input from the 'conveyor' form might populate 25 fields while...
24
19857
by: clare at snyder.on.ca | last post by:
I have a SQL query I need to design to select name and email addresses for policies that are due and not renewed in a given time period. The problem is, the database keeps the information for every...
6
2349
by: A_M_IS | last post by:
Hello group, hope to anybodys help on my temporary blackout. (Using Access 2003 on XP Win.) I know how to create and edit temporary query recordset, then I can set this data source as my form...
11
16277
by: funky | last post by:
hello, I've got a big problem ad i'm not able to resolve it. We have a server running oracle 10g version 10.1.0. We usually use access as front end and connect database tables for data extraction....
1
1906
by: cleary1981 | last post by:
Hi, I have this script for backing up a database that when it is run the option comes up to save the file. Can anyone show me how I would change this script so that the script automatically saves...
1
2268
by: kiranbabu | last post by:
<html> <head> <style type="text/css"> h2{color:#A02820} </style> </head> <script language=javascript>
0
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6726
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2987
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.