![]() |
|
#1
|
|||
|
|||
Order by highest value among columnsHi,
Let me explain the scenario. I have a PHP MySql web based system where different people are supposed to rate an artist performance. To accomplish this task, each of these five judges should enter a value (for example: 5) in one field. So i ended up with a table with five columns, labeled "judge1", judge2", and so on. This is my table: Table structure for table `artist_performances` Code:
Now, what i need is get the values entered by these judges and sort them in ascending order. Lets take these values for example: judge1 entered "5" judge2 entered "2" judge3 entered "9" judge4 entered "1" judge5 entered "3" i need to create a recordset that retrieve that info in this order: judge3 entered "9" judge1 entered "5" judge5 entered "3" judge2 entered "2" judge4 entered "1" Se the point?, How can i do this? Thaks in advance. Last edited by LuciWiz : 04-Dec-2006 at 15:05.
Reason: Added code tags
|
|
#2
|
|||
|
|||
Re: Order by highest value among columnsCan be done if u steel want to. please let me know........
|
|
#3
|
|||
|
|||
Re: Order by highest value among columnsHi, that would be great!.
How is that done? |
|
#4
|
||||
|
||||
Re: Order by highest value among columnsQ1. Are you sure you want ASCending order? What you have listed in the example result [in post #1] is in DEScending order. (by the value)
Q2. Do you really need the 'entered' word in each line -- even if you could get output to look something like this? (the format is a little broken here [I couldn't keep it aligned in the posting], but imagine it how MySQL displays its output aligned) +--------+---------+ | voter | score | +--------+---------+ | judge3 | 9 | | judge1 | 5 | | judge5 | 3 | | judge2 | 2 | | judge4 | 1 | +--------+---------+ __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
|||
|
|||
Re: Order by highest value among columnsHi,
look, i don't care about the order right now, the idea is to get the values listed so i could get rid of the lowest and highest values. If i were working with different records i could use LIMIT but in this particular case, it's a single record that stores 5 different values, the goal is to sum the values that lists between the lowest and the highest ones. When i say "get rid of" i mean not use these values, i don't really need to delete them from the DB, i just don't want to use them. Maybe there's a different way of achieving this. Maybe there's a way to sum the middle values and that's it. I'm open to all kind of resolutions at this point. Thx. |
|
#6
|
||||
|
||||
Re: Order by highest value among columnsThis will get the values similar to what you wanted in post #1, but with the output mentioned in post #4.
query: Code:
Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#7
|
|||
|
|||
Re: Order by highest value among columnsGreat, i will give it a try before posting and will let you know.
Thank you very much. |
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CPanel Hosting, Teamspeak 2 Hosting, SHOUTcast Hosting, As Low As $2.00 per Month | Kalypsoweb | Web Hosting Advertisements & Offers | 0 | 30-Jul-2006 16:00 |
| Code Contest | Paramesh | Miscellaneous Programming Forum | 76 | 30-Jun-2006 12:18 |
| Coding Contest #1 | davis | Miscellaneous Programming Forum | 0 | 12-Jun-2006 08:29 |
| Two virtual hosts, cgi script behaves differently on each | blimbo | Apache Web Server Forum | 0 | 04-Aug-2004 09:35 |
| Sorting columns by selection | dean | MySQL / PHP Forum | 1 | 03-Oct-2003 06:29 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The