Hi everyone,
I figured this would be one of the best places to go for an answer. I'm writing something for work, but after I have most of the code done (ASP page) I was told things needed to be sorted differently. We deal with billing and collections, so I'm making a journal for our customers to see the printout of their clients' billing processing. It needs to be sectioned off by billtype (checking acct, discover cards, visas, etc), and then ordered by membernum within each section. Fine, ORDER BY billtype, memnum ASC, easy.
But I need to have a "bad accounts" section before everything else. this is flagged in a badacct field in the database, which is either null or 'Y', depending. Trying to include this in my original ORDER BY would keep it ascending, meaning the bad accounts would be thrown to the bottom.
I want the bad accounts pulled to the front of the resultset, and then keep the rest ordered how it is. code sample is
SQL = "select * from journal where clubnum = '" & session("clubNumber") & "' AND batchid = '" & request.form("batchid") & "' ORDER BY billtype, memnum ASC"
If anyone can offer any suggestions of fixing this problem (the main thing here is I'm so far along I'd simply like to edit this SQL statement rather than have to rework a LOT of code to make the bad accounts a separate SQL query on the database) I would really appreciate it. You can also email me at <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> if you feel so inclined
I can't change the data in the database, so unfortunately that idea is out.
Thanks a lot everyone!
I figured this would be one of the best places to go for an answer. I'm writing something for work, but after I have most of the code done (ASP page) I was told things needed to be sorted differently. We deal with billing and collections, so I'm making a journal for our customers to see the printout of their clients' billing processing. It needs to be sectioned off by billtype (checking acct, discover cards, visas, etc), and then ordered by membernum within each section. Fine, ORDER BY billtype, memnum ASC, easy.
But I need to have a "bad accounts" section before everything else. this is flagged in a badacct field in the database, which is either null or 'Y', depending. Trying to include this in my original ORDER BY would keep it ascending, meaning the bad accounts would be thrown to the bottom.
I want the bad accounts pulled to the front of the resultset, and then keep the rest ordered how it is. code sample is
SQL = "select * from journal where clubnum = '" & session("clubNumber") & "' AND batchid = '" & request.form("batchid") & "' ORDER BY billtype, memnum ASC"
If anyone can offer any suggestions of fixing this problem (the main thing here is I'm so far along I'd simply like to edit this SQL statement rather than have to rework a LOT of code to make the bad accounts a separate SQL query on the database) I would really appreciate it. You can also email me at <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> if you feel so inclined

Thanks a lot everyone!