当前位置:网站首页>sql语句-如何以一个表中的数据为条件据查询另一个表中的数据
sql语句-如何以一个表中的数据为条件据查询另一个表中的数据
2022-07-30 04:15:00 【geejkse_seff】
下面这个是SQL语句的一个基本样式:
select *
from 表2
where 姓名 in (select 姓名
from 表1
where 条件)
实例需求:在项目中是这样应用的:我需要根据库位编号去查找库位信息表里查找库位上放的的料箱编号,我再通过料箱编号去关联的料箱信息表中查找料箱中所放的器材。(主要查询过程在(1)中查看)
下面这个是mybatis中的写法,在mappers中 Dao.xml sql语句的写法
(1)实例中在mappers中 Dao.xml sql语句的写法
根据 warehouse_location 字段在 device_book 表内查询 workbin_no字段相关的所有列表信息,去除多次重复的结果,得到workbin_no字段相关 的所有列表结果后再去device_workbin表 中查询出所有相关的信息。

(2)实例中在mappers中 Dao.xml中,对应该数据库表的所有基础字段集合。

(3)实例中对应在Dao.Java 中的写法

(4)实例中对应在service.Java 的写法

(5)实例中对应在serviceImp.Java中 的写法

(6)实例中对应在apiController.Java中 的写法

--------------------------------------以下无正文----------------------------
注:仅供学习,记录问题和参考,共勉!
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Reverse Analysis Practice 2
- error: The following untracked working tree files would be overwritten by
- Problems caused by List getting the difference
- 数据目录是什么?为何需要它?
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (1) Development Overview
- The implementation and basic operation of sub-database sub-table, ER table, global table, fragmentation rules, global sequence, etc. in MyCat
- Pytorch framework learning record 7 - convolutional layer
- Reverse Theory Knowledge 3 [UI Modification]
- CMake installation and testing
- spicy (two) unit hooks
猜你喜欢

骁龙7系芯片表现如何?Reno8 Pro佐证新一代神U

Operational configuration: How to run multiple EasyCVR programs as a service in one server?

基于OpenCV实现的图像拼接(配准)案例

Forum management system

Usage of exists in sql

Pytorch框架学习记录7——卷积层

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (7) Interim Inspection Report
Send it to your friends and let TA treat you to fried chicken!

高并发框架 Disruptor

Eureka注册中心
随机推荐
高并发框架 Disruptor
How to solve the error "no such file or directory" when EasyCVR starts?
RRU、BBU、AAU
Chapter 51 - Knowing the request header parameter analysis【2022-07-28】
Operational configuration: How to run multiple EasyCVR programs as a service in one server?
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Product (2) Mini Program Function
为什么突然间麒麟 9000 5G 版本,又有库存了?
Solve the problem of compiling and installing gdb-10.1 unistd.h:663:3: error: #error “Please include config.h first.”
使用EFR32作为Zigbee/Thread的sniffer的用法
Azure 开发者新闻快讯丨开发者7月大事记一览
数组和结构体
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (3) Background Functions
sublime text 3 settings
函数的底层机制
Pytorch framework to study record 6 - the torch. Nn. The Module and the torch nn. Functional. The use of conv2d
MySQL data query (subtotal and sorting)
Go书籍大全-从初级到高级以及Web开发
Drools (7): WorkBench
After 5 years of Ali internship interview~
High Concurrency Framework Disruptor