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

Need of Columns in the query

$
0
0
Hi,
I have written the below query

select type_payment,booked_by,sum(grand_total) GrandTotal from jp_lr group by type_payment,booked_by order by type_payment;

The output looks like the below.

Type_Payment Booked_by Grand_total
====================================
ON A/C JPANRH 2204054.00
ON A/C JPBLRY 85261.00
ON A/C JPSC 216617.00
ON A/C JPTPTH 318560.00
PAID JPTPTH 184937.00
PAID JPBLRY 111139.00
PAID JPANRH 179866.00
PAID JPSC 71332.00
TOPAY JPANRH 1248390.00
TOPAY JPTPTH 596670.00
TOPAY JPBLRY 333283.00
TOPAY JPSC 1388396.00


But what i want is the below

Booked_by ON A/C PAID TOPAY GrandTotal
========================================================
JPANRH - - - ---- ----- 
JPBLRY
JPSC
JPTPTH


Please help me out, how to generate this query.

Thanks
Madhukar

Madhukar


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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