当前位置:网站首页>mysql 多条件查询
mysql 多条件查询
2022-04-21 14:29:00 【CSDN问答】
表1
id name1 name2 gz
1 1 4 1
2 2 2
3 3 3 3
表2
nameID name
1 a
2 b
3 c
4 d
表3
gzID uname
1 e
2 f
3 g
我想用一条查询语句来查询表一关联的数据,但表一的name2字段有的记录是空的,我尝试了好多次,查询的结果都不止3条。
我想得到的结果是如下:
id name1 name2 gz nameID name nameID1 name1 gzID uname
1 1 4 1 1 a 4 d 1 e
2 2 2 2 b 2 f
3 3 3 3 3 c 3 c 3 g
表做的很粗糙,大家将就看一下
不知道大家有谁能知道我的意思,并且帮我写一句查询语句。
谢谢!
万分感谢
采纳答案:
你的需求有一个问题,结果里有两个name1,这个应该是不行的吧
版权声明
本文为[CSDN问答]所创,转载请带上原文链接,感谢
https://ask.csdn.net/questions/7691601
边栏推荐
- 顺序表--链表实现
- Implementation of basic operation of binary tree
- Why does MySQL index use B + tree instead of jump table?
- How to turn off vs Code eslint verification? Let's have a look
- 代码重构之移除对参数的赋值
- Experience and guidance of seniors preparing for the postgraduate entrance examination of Chinese International Education in Beijing Foreign Studies University in 2023
- WTL self drawing control library (cqstabctrl)
- Ros2 learning notes (XI) -- ros2 bag data recording and playback
- 53. Maximum subarray and
- 53.最大子数组和
猜你喜欢
![[groovy] mop meta object protocol and meta programming (use groovy meta programming for function interception | dynamic interception function | dynamically obtain methods in metaclass | evaluate metho](/img/3f/a4378551e5c770d6a3ab8228adab55.png)
[groovy] mop meta object protocol and meta programming (use groovy meta programming for function interception | dynamic interception function | dynamically obtain methods in metaclass | evaluate metho

Ros2 learning notes (10) -- ros2 launch startup file

Get rid of the messy if else in the project and try the state mode. This is the elegant implementation

Brutally crack the latest JVM interview question of meituan: unlimited execution

软件测试入职2个月想辞职了

股价暴跌 Robinhood收购英国加密公司求扩张

How to turn off vs Code eslint verification? Let's have a look

【Groovy】MOP 元对象协议与元编程 ( 使用 Groovy 元编程进行函数拦截 | 动态拦截函数 | 动态获取 MetaClass 中的方法 | evaluate 方法执行Groovy脚本 )

ROS2学习笔记(三)-- 采集虚拟仿真环境图像并发布

堆排序--TOP-K问题解决及复杂度分析
随机推荐
js正则表达式--个人常用
链表例题个人总结
From a comment in the source code, I trace it back to 12 years ago. It's a little interesting
【错误记录】Groovy工程中的文件查找策略 ( main 函数中需要使用 src/main/groovy/Script.groovy | Groovy 脚本直接使用代码相对路径 )
传奇服务器架设教程,传奇GM权限命令设置教程
Unmanned virtual simulation (XVI) -- obstacle detection and recognition 2
WordPress博客搭建指南
回归预测 | MATLAB实现Bayes-GRU(贝叶斯优化门控循环单元)多输入单输出
堆排序--TOP-K问题解决及复杂度分析
代码重构之内联临时变量
利用库函数qsort()来进行排序,实现及原理分析
代码重构之引入解释性变量
Insect stack
为什么覆盖equals()方法的时候,必须要覆盖hashCode()方法
Personal summary of linked list examples
从技术原理、主流平台、市场展望快速入门NFT
ROS2学习笔记(五)-- ROS2命令行操作常用指令总结(一)
Bug file operation
MySQL kills 16 questions. How long can you hold on to it?
Insect double linked list