您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

怎样将这三条mysql语句连到一起去解决方案

2024/4/14 8:24:47发布14次查看
怎样将这三条mysql语句连到一起去
select co_balance,co_isstaff from dt_co where co_id=156
select staff_group_id from dt_staff where co_id = 156
select count(*) a from dt_staff where staff_shouyetuijian = 1 and co_id = 156
在线等!!!
------解决方案--------------------
select co_balance as a,co_isstaff as b,1 as type from dt_co where co_id=156
union all
select staff_group_id as a, '' as b, 2 as type from dt_staff where co_id = 156
union all
select count(*) as a, '' as b, 3 as type from dt_staff where staff_shouyetuijian = 1 and co_id = 156
根据type判断a,b分别sql的查询结果
------解决方案--------------------
select co_balance,co_isstaff,staff_group_id,count 
from 
(select co_balance,co_isstaff from dt_co where co_id=156) a,
(select staff_group_id from dt_staff where co_id = 156) b,
(select count(*) as count from dt_staff where staff_shouyetuijian = 1 and co_id = 156) c
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product