首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

Mysql In子句剔除

2012-07-24 
Mysql In子句删除?经测试Mysql In子句中只能放一级子查询,后来改用虚表,测试可用,记录下~~~begin?create t

Mysql In子句删除

?

经测试Mysql In子句中只能放一级子查询,后来改用虚表,测试可用,记录下~~~
begin?create table ?tempTable1 ?as ?(select zpwas.`stock_id` from `zen_products_with_attributes_stock` as zpwas where zpwas.`products_id` in (select zptc.`products_id` from `zen_products_to_categories` as zptc where zptc.`categories_id` =id));delete from `zen_products_with_attributes_stock` ? where `stock_id` in (select stock_id from tempTable1);drop table tempTable1;
create table ?tempTable2 ?as ?select zpa.`products_attributes_id` from `zen_products_attributes` as zpa where zpa.`products_id` in (select zptc.`products_id` from `zen_products_to_categories` as zptc where zptc.`categories_id` =id);delete from `zen_products_attributes` ?where `products_attributes_id` in (select products_attributes_id from tempTable2);drop table tempTable2;end

热点排行