[ic] how to remove records from database

Russ Riggs interchange-users@lists.akopia.com
Fri Jun 29 22:51:01 2001


If mysql is ansi compliant then you can issue this sql from mysql:

delete from merchandising where sku matches 'os*';

or

delete from merchandising where sku like 'os*';

russ....


Raymond wrote:

> ok, I feel that I am close, but I can't complete the steps, I am
> messing up somewhere in the SQL commands:
>
> ok, I want to remove the old product IDs from the sku column
> in the merchandising table from the test_construct database;
>
> mysql> show databases;
> +----------------+
> | Database       |
> +----------------+
> | mysql          |
> | test           |
> | test_construct |
> +----------------+
> 3 rows in set (0.00 sec)
>
> mysql> use test_construct;
> Database changed
> mysql> show tables;
> +--------------------------+
> | Tables_in_test_construct |
> +--------------------------+
> | affiliate                |
> | area                     |
> | cat                      |
> | country                  |
> | gift_certs               |
> | inventory                |
> | merchandising            |
> | order_returns            |
> | orderline                |
> | pricing                  |
> | products                 |
> | recurring_items          |
> | recurring_orders         |
> | ship_addresses           |
> | transactions             |
> | userdb                   |
> +--------------------------+
> 16 rows in set (0.00 sec)
>
> mysql> show columns from merchandising;
> +-----------------+-------------+------+-----+---------+-------+
> | Field           | Type        | Null | Key | Default | Extra |
> +-----------------+-------------+------+-----+---------+-------+
> | sku             | varchar(20) |      | PRI |         |       |
> | featured        | varchar(32) |      | MUL |         |       |
> | banner_text     | text        | YES  |     | NULL    |       |
> | banner_image    | text        | YES  |     | NULL    |       |
> | blurb_begin     | text        | YES  |     | NULL    |       |
> | blurb_end       | text        | YES  |     | NULL    |       |
> | timed_promotion | text        | YES  |     | NULL    |       |
> | start_date      | varchar(24) |      | MUL |         |       |
> | finish_date     | varchar(24) |      | MUL |         |       |
> | upsell_to       | text        | YES  |     | NULL    |       |
> | cross_sell      | text        | YES  |     | NULL    |       |
> | cross_category  | varchar(64) |      | MUL |         |       |
> | others_bought   | text        | YES  |     | NULL    |       |
> | times_ordered   | text        | YES  |     | NULL    |       |
> +-----------------+-------------+------+-----+---------+-------+
> 14 rows in set (0.00 sec)
>
> mysql>
>
> mysql> select sku from merchandising;
> +-----------+
> | sku       |
> +-----------+
> | gift_cert |
> | os28004   |
> | os28005   |
> | os28006   |
> | os28007   |
> | os28008   |
> | os28011   |
> | os28044   |
> | os28057a  |
> | os28057b  |
> | os28057c  |
> | os28062   |
> | os28064   |
> | os28065   |
> | os28066   |
> | os28068a  |
> | os28068b  |
> | os28069   |
> | os28072   |
> | os28073   |
> | os28074   |
> | os28075   |
> | os28076   |
> | os28077   |
> | os28080   |
> | os28081   |
> | os28082   |
> | os28084   |
> | os28085   |
> | os28086   |
> | os28087   |
> | os28108   |
> | os28110   |
> | os28111   |
> | os28113   |
> | os29000   |
> | special01 |
> +-----------+
> 37 rows in set (0.00 sec)
>
> I want to remove all the sku's that start with os
>
> I am stuck, I tried the command from mysql.com site
> but it's not working...
>
> help.
>
> Raymond
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users