Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to combain two select query with multiple conditions in asp.net c#
my query
:

Query1:
..........

SQL
SELECT
           dbo.MemberTransactionMaster.YearID,
           Month(dbo.MemberTransactionDetails.VoucherDate)as TMonth,
           SUM(dbo.MemberTransactionDetails.Credit)
FROM       dbo.MemberTransactionMaster INNER JOIN
dbo.MemberTransactionDetails ON dbo.MemberTransactionMaster.TransactionMasterID = dbo.MemberTransactionDetails.TransactionMasterID
WHERE dbo.MemberTransactionDetails.VoucherType='WC'
GROUP BY dbo.MemberTransactionMaster.YearID,Month(dbo.MemberTransactionDetails.VoucherDate)
Order by dbo.MemberTransactionMaster.YearID,Month(dbo.MemberTransactionDetails.VoucherDate)




Query2:
...............
SQL
SELECT  SUM(dbo.MemberTransactionDetails.Debit)
FROM    dbo.MemberTransactionMaster INNER JOIN
dbo.MemberTransactionDetails ON dbo.MemberTransactionMaster.TransactionMasterID = dbo.MemberTransactionDetails.TransactionMasterID
WHERE dbo.MemberTransactionDetails.VoucherType='WW'



Any one please help me..........
Posted

1 solution

hi,

you can use In clause like
VoucherType in ('WW','WC')
instead of using two separate commands.
 
Share this answer
 
v2
Comments
Shibiny 18-Sep-12 6:59am    
but each one have different conditions
Abhijit Parab 18-Sep-12 7:24am    
Hi Shibiny,
Can you please give me the format of the output. So it will be easy to form a query.

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