数据库自联表查询
来源:互联网 发布:windows文件监控 编辑:程序博客网 时间:2024/05/19 18:10
select HTTYPE, t1.Factory, t1.H_user as 财务1,t2.H_user as 财务2,t3.H_user as 财务3 , t4.H_user as 财务4
from notices as t1,notices as t2,notices as t3 , notices as t4 ,heton where
t1.H_Type='0' and t1.type='1' and t1.Factory='XM' and t1.Factory=heton.Site and t2.H_Type='1' and t2.type='1' and t2.Factory='XM' and t2.Factory=heton.Site
and t3.H_Type='2' and t3.type='1' and t3.Factory='XM' and t3.Factory=heton.Site and t4.H_Type='3' and t4.type='1' and t4.Factory='XM' and t4.Factory=heton.Site
正式的代码
select distinct t11.notects,t1.H_factory as TSite,t1.H_user as 财务1 ,t2.H_user as 财务2,t3.H_user as 财务3,t1.SNumber
from C_User as t1 ,C_Contract_Item as t11,C_User as t2,C_User as t3,C_Contract_Item as t22,C_Contract_Item as t33
where t1.H_type='0' and t1.Type='1' and t1.H_factory='XM' and t1.H_Factory=t11.Site and t1.SNumber=t11.numbers
and t2.H_type='1' and t2.Type='1' and t2.H_factory='XM' and t2.H_Factory=t22.Site and t2.SNumber=t22.numbers
and t3.H_type='2' and t3.Type='1' and t3.H_factory='XM' and t3.H_Factory=t33.Site and t3.SNumber=t33.numbers
and t1.SNumber=t2.SNumber and t2.SNumber=t3.SNumber
- 数据库自联表查询
- android自带数据库查询
- Mybatis下的数据库表自关联查询
- Sql表自连接,数据库中查询没问题,Hibernate中查询有问题?
- 表自关联查询
- 自表查询
- 数据库联表查询ABC
- 数据库Oracle之多表查询:笛卡尔积、等值连接、不等值连接、外连接,自连接
- Mssql 查询数据库中所有有自增ID的表
- 获取通过sql查询数据库的表,字段,主键,自增,字段类型等信息。
- 自反表的查询
- HQL实现查询数据库最新数据(id自增)
- mysql查询数据库中各表的主键、自增标识
- Android自带SQLite数据库查询语句query的用法
- DB2数据库查询自增长序列的2种方式
- mysql 联表查询,查询记录、自增ID等不唯一的处理方法
- mysql数据库联表查询(四)
- 2017.12.05 数据库联表查询
- 自控力 笔记3 累到无力抵抗:为什么自控力和肌肉一样有极限
- curl笔记1
- 《算法竞赛-训练指南》第一章-1.9——UVa11210
- error LNK2019: 无法解析的外部符号
- Android 框架简介
- 数据库自联表查询
- 编写健壮的Bash shell脚本
- hdu1874(dijkstra)
- ShapeDrawable(1)
- 几个Eclipse超酷插件
- juqery之匿名函数 extend each this
- try{} catch{}
- c语言文件操作(另一个版本)
- Unity3D NGUI UIButtonTween动画事件详解