Hi all

I want to 'copy' the contents of the table 'cart', where userid=... to the 
table pending_cart.

Here is some example data for the table 'cart'
+----+--------+--------+-----+
| id | userid | prodid | qty |
+----+--------+--------+-----+
| 25 |    123 |     15 |   1 |
| 23 |    124 |     14 |   3 |
| 22 |    124 |     10 |   0 |
|  4 |    121 |     14 |   5 |
| 21 |    124 |     13 |   6 |
| 18 |    123 |     13 |   5 |
| 12 |    121 |     10 |   2 |
| 16 |    121 |     13 |   7 |
+----+--------+--------+-----+


insert into     `pending_cart`
                (`pendingid`, 
                 `prodid`, 
                 `qty`)
                select `cart`.`userid`,
                         `cart`.`prodid`,
                         `cart`.`qty`
        from `cart` 
        where `cart`.`userid`='123';

Query OK, 1 row affected (0.03 sec)
Records: 2  Duplicates: 1  Warnings: 0

When I look at pending_cart after that, 

+----+-----------+--------+-----+
| id | pendingid | prodid | qty |
+----+-----------+--------+-----+
|  0 |       123 |     15 |   1 |
+----+-----------+--------+-----+
1 row in set (0.00 sec)

I see only one record that has been copied altough more records with 
userid=123 exist in the table 'cart'


Anybody have any ideas where I went wrong?



Thank you for your help.


With kind regards



Andy
-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>++++$@ h++(*) r-->++ y--()>++++
-- ---END GEEK CODE BLOCK------
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

Attachment: pgpsJryAtBrzT.pgp
Description: PGP signature

Reply via email to