Welcome Guest, Not a member yet? Register   Sign In
MySQL Query help
#1

[eluser]andriu[/eluser]
Hi guys

I'm stuck on a sql query

Perhaps some has an idea.

I want to copy a record i "table1":

Code:
INSERT INTO table1(name, price, etc.)
SELECT name, price, etc. FROM table1
WHERE table1.record_id =13

Then I want to copy the records in "table2" related to table1.id = 13
but obvoiusly change these records record_id to the record_id of the new entry in table1.

Code:
Table 2:
id  table1_id  description etc.
1     13         some text


Is there a way to do this in one query =)?? Or am I trying to overdo it and better of doing it with php.

Thanks for any help


Messages In This Thread
MySQL Query help - by El Forum - 10-23-2009, 03:02 PM
MySQL Query help - by El Forum - 10-23-2009, 04:47 PM
MySQL Query help - by El Forum - 10-24-2009, 07:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB