Click here to Skip to main content
15,879,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1)query:-
Select SUM(expen.amount) as premonth from expen  where schemeno='W2/2013/11584' and exp_date<'2013-04-01' and  passingDate is not null


Result

Premonth
--------
Null


2)query:-
Select SUM(expen.amount) as expenamt, monyr,schemeno,sch_mas.sch_amount,sch_mas.san_no,sch_mas.disp
    from expen  inner join sch_mas on sch_mas.sch_no=expen.schemeno where exp_date>'2013-03-31' and exp_date<'2014-03-31'
	and schemeno='W2/2013/11584' group by expen.monyr,expen.schemeno,sch_mas.disp,sch_mas.sch_amount,sch_mas.san_no


Result


expenamt |monyr |schemeno
--------- --------
716274 | 201307|W2/2013/11584

What I have tried:

how to join two query records in single result 


Premonth |expenamt |monyr |schemeno
--------- -------- ------- ----------
Null | 716274 | 201307| W2/2013/11584
Posted
Updated 9-May-18 2:06am
v2
Comments
Maciej Los 9-May-18 4:05am    
Please, do not repost!
https://www.codeproject.com/Questions/1243401/Please-help-in-my-combine-SQL-query
https://www.codeproject.com/Questions/1242927/How-to-combined-two-queries-in-one-result-with-dif
Nishant.Chauhan80 9-May-18 4:06am    
srry sir but this post brief explain please see this post

1 solution

;with cte as (
Select SUM(expen.amount) as premonth from expen  where schemeno='W2/2013/11584' and exp_date<'2013-04-01' and  passingDate is not null
),cte2 as (
Select SUM(expen.amount) as expenamt, monyr,schemeno,sch_mas.sch_amount,sch_mas.san_no,sch_mas.disp
    from expen  inner join sch_mas on sch_mas.sch_no=expen.schemeno where exp_date>'2013-03-31' and exp_date<'2014-03-31'
	and schemeno='W2/2013/11584' group by expen.monyr,expen.schemeno,sch_mas.disp,sch_mas.sch_amount,sch_mas.san_no
)select * from cte,cte2
 
Share this answer
 
Comments
Nishant.Chauhan80 9-May-18 23:39pm    
thanks sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900