zoukankan      html  css  js  c++  java
  • mysql in和not in

    mysql> select * from table1;
    +----------+------------+-----+---------------------+-------+
    | name_new | transactor | pid | order_date          | price |
    +----------+------------+-----+---------------------+-------+
    | 1hahha   | 1xiaohong  |   1 | 2019-08-04 20:45:47 |     0 |
    | 2hahha   | 2xiaohong  |   2 | 2019-08-04 20:45:57 |     0 |
    | 3hahha   | 3xiaohong  |   3 | 2019-08-04 20:46:02 |     0 |
    | 4hahha   | 4xiaohong  |   4 | 2019-08-04 20:46:05 |     0 |
    | 3hahha   | bob        |   5 | 2019-08-04 20:46:08 |     0 |
    | 3hahha   | lee        |   6 | 2019-08-04 20:46:12 |     0 |
    | 3hahha   | lee        |   7 | 2019-08-04 21:56:01 |     0 |
    | 3hahha   | lee        |   8 | 2019-08-04 21:56:10 |     0 |
    | 3hahha   | bob        |   9 | 2019-08-04 21:56:18 |     0 |
    | 3hahha   | bob        |  10 | 2019-08-04 21:56:26 |     0 |
    +----------+------------+-----+---------------------+-------+
    10 rows in set (0.00 sec)
    
    
    mysql> select * from table1 where pid in (2,5);
    +----------+------------+-----+---------------------+-------+
    | name_new | transactor | pid | order_date          | price |
    +----------+------------+-----+---------------------+-------+
    | 2hahha   | 2xiaohong  |   2 | 2019-08-04 20:45:57 |     0 |
    | 3hahha   | bob        |   5 | 2019-08-04 20:46:08 |     0 |
    +----------+------------+-----+---------------------+-------+
    2 rows in set (0.01 sec)
    
    
    mysql> select * from table1 where pid not in (2,5);
    +----------+------------+-----+---------------------+-------+
    | name_new | transactor | pid | order_date          | price |
    +----------+------------+-----+---------------------+-------+
    | 1hahha   | 1xiaohong  |   1 | 2019-08-04 20:45:47 |     0 |
    | 3hahha   | 3xiaohong  |   3 | 2019-08-04 20:46:02 |     0 |
    | 4hahha   | 4xiaohong  |   4 | 2019-08-04 20:46:05 |     0 |
    | 3hahha   | lee        |   6 | 2019-08-04 20:46:12 |     0 |
    | 3hahha   | lee        |   7 | 2019-08-04 21:56:01 |     0 |
    | 3hahha   | lee        |   8 | 2019-08-04 21:56:10 |     0 |
    | 3hahha   | bob        |   9 | 2019-08-04 21:56:18 |     0 |
    | 3hahha   | bob        |  10 | 2019-08-04 21:56:26 |     0 |
    +----------+------------+-----+---------------------+-------+
    8 rows in set (0.00 sec)

  • 相关阅读:
    Jmeter之CSV文件读取
    性能计数器及性能分析方法
    性能测试的应用领域
    动态加载JS文件方法总结
    handler method 参数绑定常用注解
    A4纸网页打印
    page-break-before和page-break-after 实现分页打印
    $.ajax 中的contentType
    @Controller和@RestController的区别?
    web页面内容打印总结
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11300603.html
Copyright © 2011-2022 走看看