Solved

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

Posted on 2016-09-05
3
30 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. Completed & Recieved 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
  • 2
3 Comments
 
LVL 49

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 49

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now