Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-09-05
3
Medium Priority
?
77 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 53

Accepted Solution

by:
Ryan Chong earned 2000 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 53

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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 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