473,789 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copy field from one table to another

Hi,
i am trying to copy a completed field set from one table to another.
I am using this SQL command:
INSERT INTO doc_valid SELECT * from doc_temp where id=$id

it works, but it also copy the index field id from my temp table to the
valid table...
the index are autoincrement primary key, and it should take the next index
value....

How can i make this copy and use the auto incremental index of the
destination table??

Nov 26 '07 #1
2 1817
VooDoo wrote:
Hi,
i am trying to copy a completed field set from one table to another.
I am using this SQL command:
INSERT INTO doc_valid SELECT * from doc_temp where id=$id

it works, but it also copy the index field id from my temp table to the
valid table...
the index are autoincrement primary key, and it should take the next index
value....

How can i make this copy and use the auto incremental index of the
destination table??

Ask in comp.databases. mysql. This has nothing to do with PHP.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 26 '07 #2
VooDoo wrote:
Hi,
i am trying to copy a completed field set from one table to another.
I am using this SQL command:
INSERT INTO doc_valid SELECT * from doc_temp where id=$id

it works, but it also copy the index field id from my temp table to
the valid table... the index are autoincrement primary key, and it
should take the next index value....

How can i make this copy and use the auto incremental index of the
destination table??
Although this question has more to do with MySQL than PHP, and should
rather have been posed in comp.databases. mysql, you might try
specifying the field names you want to extract from the temp table
instead of * (which means ALL fields, including the "id" field).

--
Kim André Akerø
- ki******@NOSPAM betadome.com
(remove NOSPAM to contact me directly)
Nov 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1842
by: middletree | last post by:
I have a table which has a datetime field for when a row in this one table (Ticket) was created. This is for trouble tickets for a help desk. After a ticket has been created, any additions to that ticket are recorded in another table called History. There could be several additions, thus the splitting up into a one-to-many relationship. In order to meet the boss's request, I recently added a LastModified field to the Ticket table. I...
4
2062
by: sparks | last post by:
1 need to copy the data in one table into another...but its from another database. tables are demographics and testdata database1 database2 demographics personid personid same in both databases eval eval same in both databases autoid autoid different testdata
0
1942
by: gary b | last post by:
My forehead is sore from beating it against the wall. Can anyone help? I've started drinking again because of this problem! Setup: ContestantTbl = table ('one' side) HorseTbl = table ('many' side) Race1Qry = query based on BOTH tables Race1EditorFrm = Main form (display info originating from
1
2568
by: Sean Howard | last post by:
Dear All, As is my want I need to do something in Access that seems simple but cannot fathom out. I have main form with two subforms, both datasheets with an almost identical table structure. I want to add the functionality to copy records from subformA to subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
5
2927
by: Clodoaldo Pinto Neto | last post by:
Hello, How to make sure COPY TO writes the table lines to the file in the same order they were inserted? I'm producing html pages in pl/pgsql and using COPY TO to write then to file. Occasionaly, about once in 7 or 9, the lines are copied to the file out of the order they were inserted in the table. The lines have one only column of the type text.
9
10038
by: David Rysdam | last post by:
I have a large amount of data that I copy in and out of Sybase very often. Now I also want to copy this data in and out of postgres. I have an existing script that creates the entire database(s) from scratch in Sybase and then uses the Sybase bulk copy tool "bcp" to copy the data in. I already did a brute force port of this script to postgres once, but I'm trying to do it more elegantly now that I know what issues I'm going to run...
2
3469
by: Swinky | last post by:
I hope someone can help...I feel like I'm walking in the dark without a flashlight (I'm NOT a programmer but have been called to task to do some work in Access that is above my head). I have code that will successfully copy a record and append the information to a new record in the same table (parent table) within a form. However, there are related child tables with primary keys (set to Autonumber) stored in sub-forms. That information...
4
6354
by: colmkav | last post by:
Hi, I need to copy a linked table but without keeping the link. ie all the data and settings accept for the link to another db. How can I do this? Colm
2
1369
rightclick
by: rightclick | last post by:
I am setting up a database to be used to keep a point ranking system for my table tennis school. I have a table tblMain with records for each player. It includes a field called StartOfSeasonRank. I have set this to a text datatype. No calculations are performed on this field. It only stores the ranking position of the player at the start of the season and is used in the reporting. At the start of a new season I would like to reset the...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10127
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8998
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5540
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.