MySQL左联多表查询where条件写法示例

作者:junjie 时间:2024-01-14 08:44:43 


select * from _test a left join _test b on a.id=b.id where a.level='20' and a.month='04' and b.level='20' and b.month='03';

select a.*,b.* from (select * from _test where level='20' and month='04') as a left join (select * from _test where level='20' and month='03') as b on a.id=b.id;

这两条语句结果是不同的,应该是left join的时候如果条件是多个表mysql会自动转成内联导致,第二条语句才能达到正确的目的(为了找到相差的两条数据)。

MySQL左联多表查询where条件写法示例

MySQL左联多表查询where条件写法示例

标签:MySQL,左联,多表,查询,where
0
投稿

猜你喜欢

  • Python 统计位数为偶数的数字代码详解

    2023-12-05 19:43:03
  • Centos 6.5系统下编译安装PHP 7.0.13的方法

    2023-06-07 13:04:26
  • pytorch实现focal loss的两种方式小结

    2023-07-02 14:43:22
  • Select count(*)、Count(1)和Count(列)的区别及执行方式

    2024-01-28 14:43:04
  • Docker配置PHP开发环境教程

    2023-08-17 04:19:49
  • python pandas库读取excel/csv中指定行或列数据

    2022-10-11 21:05:04
  • 利用Python通过获取剪切板数据实现百度划词搜索功能

    2023-07-14 06:59:06
  • 使用PyInstaller将Pygame库编写的小游戏程序打包为exe文件及出现问题解决方法

    2021-09-17 08:53:15
  • pytorch中的inference使用实例

    2023-07-24 16:22:56
  • JS+DIV实现拖动效果

    2023-07-02 05:19:37
  • Sql Server 2012 转换函数的比较(Cast、Convert和Parse)

    2012-08-21 10:21:40
  • ThinkPHP使用smarty模板引擎的方法

    2023-11-14 11:37:19
  • 深入讲解HTTPS中的加密算法

    2023-01-20 18:10:52
  • SQL Server密码管理的六个危险判断

    2008-10-23 13:57:00
  • pytorch和numpy默认浮点类型位数详解

    2021-11-10 10:19:49
  • 99%的程序员都会收藏的书单 你读过几本?

    2022-10-01 19:45:59
  • 详解Python模块化编程与装饰器

    2023-06-30 19:49:07
  • java EJB 加密与解密原理的一个例子

    2023-10-02 06:41:16
  • php使用递归与迭代实现快速排序示例

    2023-11-14 09:46:31
  • 关于浏览器地址栏的小图标favicon.ico制作

    2010-03-07 15:57:00
  • asp之家 网络编程 m.aspxhome.com