List:General Discussion« Previous MessageNext Message »
From:Voytek Eymont Date:March 27 2010 4:17am
Subject:sql to duplicate records with modified value
View as plain text  
I have Postfix virtual mailboxes in MySQL table like below:

I'd like to duplicate all records whilst MODIFYING two fields like so:

current record has format like:
user 'username@stripped'
maildir 'domain.tld/username@stripped/'

add new record that has:
user 'username+spam@stripped'
maildir 'domain.tld/username@stripped/.spam/'

so that I'll end up with two record, existing, plus new one

field 'user' - insert '+spam' ahead of '@'
field 'maildir' append '.spam/'

what's the best way
mysql  Ver 14.7 Distrib 4.1.22, for pc-linux-gnu (i686) using readline 4.3
Server version:         4.1.22-standard

mysql> show tables;
+-----------------------+
| Tables_in_postfix     |
+-----------------------+
| admin                 |
| alias                 |
| config                |
| domain                |
| domain_admins         |
| fetchmail             |
| log                   |
| mailbox               |
| vacation              |
| vacation_notification |
+-----------------------+
10 rows in set (0.00 sec)


-- 
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