i have scenario purchase can paid either cash,card or voucher above three. need report show payment types in seperate lines captured these value in single row. problem how transfer rows values columns .
for ex.
╔═════════════════════════════════════════════════════╗ ║ order amount cash card voucher ║ ╠═════════════════════════════════════════════════════╣ ║ purchase1 1000 500 300 200 ║ ╚═════════════════════════════════════════════════════╝ but need result has
╔══════════════════════════════════╗ ║ order amount paytype ║ ╠══════════════════════════════════╣ ║ purchase1 500 cash ║ ║ purchase1 300 card ║ ║ purchase1 200 voucher ║ ╚══════════════════════════════════╝ let can provide suggestions accomplish above format.
i suggest use union all this:
select order, cash amount, 'cash' paytype union select order, card, 'card' union select order, voucher, 'voucher'
Comments
Post a Comment