473,322 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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 1787
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*******@attglobal.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******@NOSPAMbetadome.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
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...
4
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...
0
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 ...
1
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....
5
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....
9
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)...
2
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...
4
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
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....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.