Solved

Sorting - Classic asp putting a specific text @ the top of the table

Posted on 2016-09-05
3
65 Views
Last Modified: 2016-09-05
Hi all,

I've gotten a customer request. I have a task management system with various types of status. CompletedRecieved being one of them. My customer wants Recieved @ the top. However it's a Text based column in mySQL. I would normally sort either ASC or DESC, but neither puts Recieved @ the top. Anyway around this?

Best regards
Michael
0
Comment
Question by:micamb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 41784882
>>I would normally sort either ASC or DESC, but neither puts Recieved @ the top. Anyway around this?

in your table: Task, just add another column called as seq (sequence), and then set the value of seq to 1 for Recieved, while set other records' seq to value greater than 1.

then change your query's order by to first order by seq ASC

like:
select * from Task order by seq, status

Open in new window

hope this make sense to you
0
 

Author Comment

by:micamb
ID: 41785615
Hi Ryan,

It does, but I was hoping to avoid that. I'll ponder over it for a while 'cause it's going to take some re-coding of the rest of my site.

I'll award you the points though as it is a sound solution.
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 41785617
if you do not want to have an additional column to determine the sequence ordering, then you will need to "hardcode" the ordering in your SQL statement, which in some cases, it's a valid solution.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question