|
-
Jan 27th, 2012, 06:31 AM
#1
Thread Starter
New Member
Table order breaking.
Dear Members,
I am new to forum. I have a problem regarding order by clause. Suppose my clients cash data is as following for the date 24/01/12:
24/01/12:
1. Cash paid to Mr. A 5000.00 Payment Voucher
2. Cash paid to Mr.B 2000.00 Payment Voucher
3. Cash paid to Mr.C 2500.00 Payment Voucher
4. Cash recd from Mr.D 6000.00 Receipt Voucher
5. Cash recd from Mr.E 8000.00 Receipt Voucher
6. Cash paid to Mr.F 4000.00 Payment Voucher
My client is not maintaining voucher number. I have a field DRCR containing “D” for payment & “C” for receipts. My output for cash should look like following:
24/01/12:
4. Cash recd from Mr.D 6000.00 Receipt Voucher
5. Cash recd from Mr.E 8000.00 Receipt Voucher
1. Cash paid to Mr. A 5000.00 Payment Voucher
2. Cash paid to Mr.B 2000.00 Payment Voucher
3. Cash paid to Mr.C 2500.00 Payment Voucher
6. Cash paid to Mr.F 4000.00 Payment Voucher
Order should be receipts first then payments in their respective order.
I am passing the following query:
mSqlQry = "select trndata.`vchrdate`, trndata.`vchrno`, trndata.`acctcode`," & _
" trndata.`narr`, trndata.`amount`, trndata.`drcr`, acctmaster.`acctdesc`," & _
"acctmaster.`station`, acctmaster.`acctcode` " & _
"from `trndata` trndata inner join `acctmaster` acctmaster on trndata.`acctcode` = acctmaster.`acctcode`" & _
"where format(vchrdate,'yyyy/mm/dd') between format('" & mDateFrom & "','yyyy/mm/dd') and format('" & mDateTo & "','yyyy/mm/dd') and trncode = '" & mTrnCode & "' order by vchrdate, drcr"
TempTrnDataRs.CursorType = adOpenKeyset
TempTrnDataRs.LockType = adLockOptimistic
TempTrnDataRs.Open mSqlQry, gConnect
But after ordering my results are as below:
5. Cash recd from Mr.E 8000.00 Receipt Voucher
4. Cash recd from Mr.D 6000.00 Receipt Voucher
6. Cash paid to Mr.F 4000.00 Payment Voucher
3. Cash paid to Mr.C 2500.00 Payment Voucher
2. Cash paid to Mr.B 2000.00 Payment Voucher
1. Cash paid to Mr. A 5000.00 Payment Voucher
I dont know where I am wrong... please suggest me...
regards
Vijay
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|