List:General Discussion« Previous MessageNext Message »
From:Voytek Eymont Date:March 27 2010 1:09pm
Subject:Re: sql to duplicate records with modified value
View as plain text  
<quote who="Rhino">
> Voytek Eymont wrote:

> Are you  hoping to do all that you want - copy rows, update rows and
> create new rows - in a single SQL statement? Because if that's what you
> want, I don't think it's possible. Unless someone has come up with some
> new tricks, you can't insert a new record and update an existing one
> within the same SQL statement.
>
> If you want to do it via several SQL statements, each part of what you
> want should be possible via different statements in a script where you can
> use the script itself to help with the update logic. If you want to do the
> updates from the command line only and won't consider a program, I don't
> know how to do it.
>
> I should point out that I'm quite fluent in SQL and have been writing it
> for a long time. I haven't used MySQL in a few years now but I'm still on
> the mailing list and your question caught my eye.

Rhino, thanks

a script would be great, if you can help with it, I'd be grateful.

I'm not sure where/how to start, the username is a primary index.

or do I run a dump, then, work some script over dump, and, re-import ?


-- 
Voytek

Thread
sql to duplicate records with modified valueVoytek Eymont27 Mar
  • Re: sql to duplicate records with modified valueRhino27 Mar
    • Re: sql to duplicate records with modified valueVoytek Eymont27 Mar
  • Re: sql to duplicate records with modified valueRay Cauchi27 Mar
    • Re: sql to duplicate records with modified valueVoytek Eymont28 Apr