zoukankan      html  css  js  c++  java
  • 一个sql很多个not like的简化语句

    如:
    select * from table where `zongbu` not like '%北京%' and `zongbu` not like '%上海%' and `zongbu` not like '%深圳%' and `zongbu` not like '天津' and `zongbu` not like '香港' and `zongbu` not like '沈阳';

    SELECT * FROM table WHERE zongbu NOT REGEXP '北京|上海|深圳|天津|香港|沈阳';

    GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY '222222' WITH GRANT OPTION;
    
    
    GRANT ALL PRIVILEGES ON *.* TO admin@"%" IDENTIFIED BY '222222' WITH GRANT OPTION;
    
    
    
     
    货品表
    update iac_goods a,iac_goods_base b   set a.goods_desc=b.goods_desc where  a.goods_desc='' and b.goods_desc<>'' and b.g_id=goods_id;
    
    
    select goods_id,b.g_id,a.goods_desc,b.goods_desc from iac_goods as a ,iac_goods_base as b where a.goods_desc='' and b.goods_desc<>'' and b.g_id=goods_id; 
    
    select goods_id,b.g_id,a.goods_desc,b.goods_desc from iac_goods as a ,iac_goods_base as b where a.goods_desc=''  and b.g_id=goods_id; 
    
    
    
    
    //商品表
    
    select g_id,goods_name,goods_desc from iac_goods_base where goods_desc<>'';
    
    
    
    
    select goods_id goods_sn from iac_goods where goods_sn='';
    
    update iac_goods set goods_sn=concat('IAC', goods_id) where goods_sn='' or goods_sn not like 'IAC%';
    
    update iac_goods set goods_sn=concat('IAC', goods_id) where goods_sn='' or goods_sn not like '%IAC%';
    
    select goods_id ,goods_sn from iac_goods where goods_sn not like 'IAC%';
    
    
    select * from table where `zongbu` not like '%北京%' and `zongbu` not like '%上海%' and `zongbu` not like '%深圳%' and `zongbu` not like '天津' and `zongbu` not like '香港' and `zongbu` not like '沈阳'
    
    SELECT * FROM table WHERE zongbu NOT REGEXP '北京|上海|深圳|天津|香港|沈阳';
    

    //从另一个表insert多条记录

    insert into goods(goods_name,goods_price,goods_num,goods_desc,pubtime,goods_pic) select goods_name,goods_price,goods_num,goods_desc,pubtime,goods_pic from goods;

  • 相关阅读:
    21.Merge Two Sorted Lists 、23. Merge k Sorted Lists
    34. Find First and Last Position of Element in Sorted Array
    leetcode 20. Valid Parentheses 、32. Longest Valid Parentheses 、301. Remove Invalid Parentheses
    31. Next Permutation
    17. Letter Combinations of a Phone Number
    android 常见分辨率(mdpi、hdpi 、xhdpi、xxhdpi )及屏幕适配注意事项
    oc 异常处理
    oc 类型判断
    oc Delegate
    oc 协议
  • 原文地址:https://www.cnblogs.com/hnbiao/p/4778916.html
Copyright © 2011-2022 走看看