Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pilugr
Starting Member
2 Posts |
Posted - 2009-04-23 : 10:03:02
|
| HiI have 2 tables: Person and PersonCar - something like this:CREATE TABLE `database1`.`Person` ( `id` INTEGER UNSIGNED NOT NULL, `name` VARCHAR(100)) NOT NULL, `added_date` DATETIME NOT NULL, PRIMARY KEY (`id`))CREATE TABLE `database1`.`PersonCar` ( `id` INTEGER UNSIGNED NOT NULL, `person_id` INTEGER UNSIGNED NOT NULL, `plate_no` VARCHAR(50) NOT NULL, PRIMARY KEY (`id`))This is how I delete for those from 2008 or older (delete car aswell if person has a car):DELETE Person, PersonCar FROM Person LEFT OUTER JOIN PersonCar ON Person.id = PersonCar.person_id WHERE Person.added_date < '2009-01-01 00:00:00'My question is: how do I make backup to 2 other identical tables Person_backup and PersonCar_backup in 1 query - in the same manner as the above delete query (copying car is person has a car)? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-23 : 10:06:15
|
Are you using Microsoft SQL Server, or MySQL? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
pilugr
Starting Member
2 Posts |
Posted - 2009-04-23 : 10:07:38
|
| its mysql - it should be the same syntax |
 |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-23 : 10:08:27
|
| Why do you have to make it 1 query? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-23 : 10:10:17
|
I'd suggest you turn to www.dbforums.com.They have an excellent MySQL forum.And no, databases do not use the same syntax everywhere. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|