sql将两张表里查到得数据在一张表里显示
我要在第一眼张表里查询出一条数据在第二张表里查出第二条数据但是这两张表没有必然的联系selectS_PriceastotalfromSPInfowhereS_IDin(s...
我要在第一眼张表里查询出 一条数据 在第二张表里查出第二条数据 但是这两张表 没有必然的联系select S_Price as total from SPInfo where S_ID in(select S_ID from feeInfo)
select count(S_ID) as totals from FeeInfo group by S_ID要将这两个的结果 显示为一张表的两个字段 展开
select count(S_ID) as totals from FeeInfo group by S_ID要将这两个的结果 显示为一张表的两个字段 展开
5个回答
展开全部
select a.total,b.totals into 新好差历表友搜庆神名 from
(select S_Price as total from SPInfo where S_ID in(select S_ID from feeInfo) ) as a,
(select count(S_ID) as totals from FeeInfo group by S_ID) as b
(select S_Price as total from SPInfo where S_ID in(select S_ID from feeInfo) ) as a,
(select count(S_ID) as totals from FeeInfo group by S_ID) as b
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-04-07
展开全部
用条子查询就唯猜搞定了呀,我没理解错你要的效果吧指指型?select S_Price as total ,(select count(S_ID) as totals from FeeInfo group by S_ID) as '第二条语句字逗则段' from SPInfo where S_ID in(select S_ID from feeInfo)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select S_Price as total from SPInfo where S_ID in(select S_ID from feeInfo)
如散仿果两张表没有必然联系,你为什么还用冲带纤到嵌套表行首呢?
select distinct COUNT(S_ID) over(partition by S_ID) ,S_Price as total
from FeeInfo ,SPInfo
如散仿果两张表没有必然联系,你为什么还用冲带纤到嵌套表行首呢?
select distinct COUNT(S_ID) over(partition by S_ID) ,S_Price as total
from FeeInfo ,SPInfo
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-04-07
展开全部
为什么不用视图?你本来要悔此解决的问题是什么?怎么用这样的方法处理问题?很怪。烂拿直接问你的原饥前搭始问题,让大家帮你想个合适的算法。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-04-07
展开全部
可以使用连接查询,join
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询