Order By [message #373809] |
Mon, 14 May 2001 02:05 |
momen
Messages: 9 Registered: May 2001
|
Junior Member |
|
|
Hi all,
I have a Voucher Table and I need to select the debit transactions first, and among debit trans. it should be ordered by all Items of type 'B' and then 'A'. Here is the table desc. & a sample data.
Vou_No Serial Item_No Item_Type Debit Credit
-------------------------------------------------------------
200010 1 1910300 A 0 698
200010 2 1910300 A 0 741
200010 3 1910300 A 0 751
200010 4 1910300 A 0 350
200010 5 1910300 A 0 254
200010 6 8510300 A 0 662
200010 7 3302000 A 3090 0
200010 8 0110100 B 450 0
200010 9 031000 B 0 84
The o/p should be
Vou_No Serial Item_No Item_Type Debit Credit
---------------------------------------------
200010 8 0110100 B 450 0
200010 7 3302000 A 3090 0
200010 9 031000 B 0 84
200010 1 1910300 A 0 698
200010 2 1910300 A 0 741
200010 3 1910300 A 0 751
200010 4 1910300 A 0 350
200010 5 1910300 A 0 254
200010 6 8510300 A 0 662
Any help will be appreciated.
Thanks in advance.
Regards,
Momen.
|
|
|
Re: Order By [message #373850 is a reply to message #373809] |
Tue, 15 May 2001 17:01 |
Sundar Venkatasubramaniam
Messages: 26 Registered: May 2001
|
Junior Member |
|
|
If you want other than this please explain in more detail.
Assume all are non null fields
do you want to try this
select * from voucher order by to_number(ascii(Item_Type) ||rpad(Debit,90,0)) desc
|
|
|
Re: Order By [message #373851 is a reply to message #373809] |
Tue, 15 May 2001 17:06 |
Sundar Venkatasubramaniam
Messages: 26 Registered: May 2001
|
Junior Member |
|
|
If you want other than this please explain in more detail.
Assume all are non null fields
do you want to try this
select * from voucher order by to_number(ascii(Item_Type) ||rpad(Debit,90,0)) desc
|
|
|