Jump to content

How Can I Combine Two Sql Query ?


assassin87
 Share

Recommended Posts

Hi everyone i want to ask something. Now i have six queries from same stored procdure but i want combine that queries just one query. Here my queries GELİRSELECT SUM(REVENUE) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) DÜZELTMESELECT SUM(REVENUE) FROM SP_FOLTRANS_STATS_DAY (:B1,:D1) WHERE PAYTYPE='DUZELTME' KREDİSELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE PAYTYPE='KREDI' NAKİTSELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE CASHTYPE = 'NAKIT' KREDİ KARTISELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE CASHTYPE = 'MASTER' OR CASHTYPE = 'VISA' İNDİRİMSELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE PAYTYPE = 'INDIRIM' Now i want GELIR,DUZELTME,KREDI,NAKIT,KREDI KARTI AND INDIRIM with just one query. Can you help me, how can i do that ?

Link to comment
Share on other sites

you can use union if the data type of columns and count of columns in every query matches

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...