Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

SQL Help on Query

$
0
0

HI All,

I have a table with below  data

ID  VoucherID  ClientID    Subdate   AmtRed    RedeemDate   ServiceType1 ServiceType2   ServiceType3
1     123            ABC     2014-07-24 1000        2014-06-04            1                      Null              NUll
2     123            ABC     2014-07-24   200        2014-06-04              Null                     1                NUll
3     234           CDE       2014-08-05 1500        2014-07-01            NUll                    Null                 1

Below is the output I need - I Appreciate any idea

If multiple services are selected for a Same voucherID, it will be counted as 'bundled services' else the servicename

VoucherID    ClientID      Amountredeem    ReddemCount       ServiceName         ServiceGroup
123                   ABC                 1200                    1                       Bundle Services    BundleServices
123                   CDE                 1500                    1                      ServiceType3     ServiceType3



Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>