尚站互联
  • 首页
  • PHP
  • MYSQL
  • JavaScript
  • HTML
  • Laravel
  • Linux
  • Java

Daily Archives: 2019年1月9日

You are browsing the site archives by date.
091月 2019

MySQL查询在一个表而不在另一个表中的数据

by 爱偷吃猫的鱼

1、使用not in,容易理解,效率低

select distinct A.ID from A where A.ID not in (select ID from B)

2、使用left join…on… ,B.ID isnull表示左连接之后在B.ID字段为null的记录

select A.ID from A left join B on A.ID=B.ID where B.ID is null

分类

  • CSS
  • Elasticsearch
  • GO
  • HTML
  • Java
  • JavaScript
  • K8S
  • Laravel
  • Linux
  • Lua
  • MongoDB
  • MYSQL
  • nodejs
  • PHP
  • Python
  • Redis
  • stylus
  • vuejs
  • 笔记
2019年 1月
一 二 三 四 五 六 日
 123456
78910111213
14151617181920
21222324252627
28293031  
« 12月   5月 »
© Copyright 2025 - 尚站互联 豫ICP备12021084号-1
Contango Theme ⋅ Powered by WordPress