Solved

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

Posted on 2016-09-05
3
52 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
  • 2
3 Comments
 
LVL 51

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 51

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 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