Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Order by

Author  Topic 

JanakiRam
Starting Member

22 Posts

Posted - 2013-07-17 : 08:02:52
Hi.,

I have a result set

Customer_Ledger_ID Date Payment_Type Payment_Detail_Number Credit Debit
17 07/17/2013 Card XXXX XXXX XXXX 1111 130.00 0
18 07/17/2013 Card XXXX XXXX XXXX 1111 0 130.00
19 07/17/2013 Card XXXX XXXX XXXX 1111 63.17 0
20 07/17/2013 Card XXXX XXXX XXXX 1111 0 63.17
like this
but i need a display set
Customer_Ledger_ID Date Payment_Type Payment_Detail_Number Credit Debit
18 07/17/2013 Card XXXX XXXX XXXX 1111 0 130.00
17 07/17/2013 Card XXXX XXXX XXXX 1111 130.00 0
20 07/17/2013 Card XXXX XXXX XXXX 1111 0 63.17
19 07/17/2013 Card XXXX XXXX XXXX 1111 63.17 0

like this please verify

JanakiRam

edit: moved to proper forum

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-17 : 08:11:11
quote:
Originally posted by JanakiRam

Hi.,

I have a result set

Customer_Ledger_ID Date Payment_Type Payment_Detail_Number Credit Debit
17 07/17/2013 Card XXXX XXXX XXXX 1111 130.00 0
18 07/17/2013 Card XXXX XXXX XXXX 1111 0 130.00
19 07/17/2013 Card XXXX XXXX XXXX 1111 63.17 0
20 07/17/2013 Card XXXX XXXX XXXX 1111 0 63.17
like this
but i need a display set
Customer_Ledger_ID Date Payment_Type Payment_Detail_Number Credit Debit
18 07/17/2013 Card XXXX XXXX XXXX 1111 0 130.00
17 07/17/2013 Card XXXX XXXX XXXX 1111 130.00 0
20 07/17/2013 Card XXXX XXXX XXXX 1111 0 63.17
19 07/17/2013 Card XXXX XXXX XXXX 1111 63.17 0

like this please verify

JanakiRam

What is the rule that you want to use in the new ordering scheme? I can see that in the original ordering scheme, Customer_Ledger_ID was used. But, I cannot discern any pattern to the new ordering scheme.
Go to Top of Page

JanakiRam
Starting Member

22 Posts

Posted - 2013-07-17 : 08:16:19
quote:
Originally posted by James K

quote:
Originally posted by JanakiRam

Hi.,

I have a result set

Customer_Ledger_ID Date Payment_Type Payment_Detail_Number Credit Debit
17 07/17/2013 Card XXXX XXXX XXXX 1111 130.00 0
18 07/17/2013 Card XXXX XXXX XXXX 1111 0 130.00
19 07/17/2013 Card XXXX XXXX XXXX 1111 63.17 0
20 07/17/2013 Card XXXX XXXX XXXX 1111 0 63.17
like this
but i need a display set
Customer_Ledger_ID Date Payment_Type Payment_Detail_Number Credit Debit
18 07/17/2013 Card XXXX XXXX XXXX 1111 0 130.00
17 07/17/2013 Card XXXX XXXX XXXX 1111 130.00 0
20 07/17/2013 Card XXXX XXXX XXXX 1111 0 63.17
19 07/17/2013 Card XXXX XXXX XXXX 1111 63.17 0

like this please verify

JanakiRam

What is the rule that you want to use in the new ordering scheme? I can see that in the original ordering scheme, Customer_Ledger_ID was used. But, I cannot discern any pattern to the new ordering scheme.


I need to show first Debit Value so need the second result set

JanakiRam
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-17 : 08:29:27
How do you associate the two first two rows together? Is there any other column that tells you that the first two rows are a pair and the second two rows are another pair? Granted, the credit value of one is equal to the debit value of the other. But couldn't there be many transactions with the exactly identical credit values?
Go to Top of Page
   

- Advertisement -