If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Get rid of maximun and minimun values among several fields

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-07-06, 13:22
marovios marovios is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Get rid of maximun and minimun values among several fields

This is it, say i have six numeric fields to fill in.
What i need is to get rid of the biggest and smallest numbers among these six fields, so i can take into account just the middle four left fields. It's a system for ranking persons performances.

For example:
field#1= 6.3
field#2= 2.3
field#3= 7.5
field#4= 4.9
field#5= 8.3
field#6= 4.5

and i need to get rid of the biggest and lowest entered values, in this case, i should get rid of fields #2 and #5

How can i do this?. any idea?
Thanks
Reply With Quote
  #2 (permalink)  
Old 09-07-06, 23:23
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
that depends on what you mean by "get rid of"

what are you actually trying to do, update the row?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 09-08-06, 12:57
marovios marovios is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Not really, i mean not to use them, maybe what i need is a subrecordset that doesn't take into account the highest and lowest values from those fields
Reply With Quote
  #4 (permalink)  
Old 09-08-06, 13:03
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
could you show the query that you want to use the middle 4 fields in?

i'm having a hard time picturing a "subrecordset"
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 02-08-07, 14:22
marovios marovios is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Hi,
it's done. I'v used the LIMIT function to get rid of the last and first values.
Now, is there a way to sum these middle values?, i've tried the SUM() but had no luck.
Reply With Quote
  #6 (permalink)  
Old 02-08-07, 14:28
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
use SUM() in an outer query, put your query as the subquery
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On