本文介绍了如何在一个结果中将两个查询与不同的列和条件组合在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

query1: -

Select expen.schemeno, sum(expen.amount) as Premonth,sch_mas.disp,sch_mas.sch_amount,
 sch_mas.san_no , CONVERT(varchar, sch_mas.sdate, 106)as schdate  from [dbo].[expen] inner join
  sch_mas on expen.schemeno=sch_mas.sch_no  where schemeno='W2/2013/11516' and exp_date<'2013-04-01' and 
  passingDate is not null group by sch_mas.disp, expen.schemeno,sch_mas.sch_amount,sch_mas.sdate,sch_mas.san_no





查询2: -

Select monyr, SUM(expen.amount) as expenamt,schemeno from expen  where exp_date>'2013-03-31' and exp_date<'2014-03-31' and schemeno='W2/2013/11516' group by monyr,schemeno





我尝试了什么:





What I have tried:

combined two  queries in one result with different columns and conditions

推荐答案


这篇关于如何在一个结果中将两个查询与不同的列和条件组合在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 03:37