dbTalk Databases Forums  

Query to Find Difference in Greatest and Least Values in Field

comp.databases.mysql comp.databases.mysql


Discuss Query to Find Difference in Greatest and Least Values in Field in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
BlueBrooke
 
Posts: n/a

Default Query to Find Difference in Greatest and Least Values in Field - 08-05-2006 , 10:42 AM






Hi --

I need to find the highest and lowest entries in a field, and calculate
the difference. Can I do this with one query (mysql 4.0.2)?

I'm just getting back into php/mysql after a year's absence, so I'm sorry
if this is a basic question. I'm sure something simple is escaping me --
and will come to me as soon as this hits the server. Googled into the wee
hours with no success.

Thanks for any help --

Blue

Reply With Quote
  #2  
Old   
strawberry
 
Posts: n/a

Default Re: Query to Find Difference in Greatest and Least Values in Field - 08-05-2006 , 11:11 AM







BlueBrooke wrote:
Quote:
Hi --

I need to find the highest and lowest entries in a field, and calculate
the difference. Can I do this with one query (mysql 4.0.2)?

I'm just getting back into php/mysql after a year's absence, so I'm sorry
if this is a basic question. I'm sure something simple is escaping me --
and will come to me as soon as this hits the server. Googled into the wee
hours with no success.

Thanks for any help --

Blue
so what have you got so far?

SELECT max( fieldname ) - min( fieldname )
FROM table



Reply With Quote
  #3  
Old   
BlueBrooke
 
Posts: n/a

Default Re: Query to Find Difference in Greatest and Least Values in Field - 08-05-2006 , 11:25 AM



On Sat, 05 Aug 2006 11:11:59 -0500, strawberry <zac.carey (AT) gmail (DOT) com> wrote:

Quote:
BlueBrooke wrote:
Hi --

I need to find the highest and lowest entries in a field, and calculate
the difference. Can I do this with one query (mysql 4.0.2)?

I'm just getting back into php/mysql after a year's absence, so I'm
sorry
if this is a basic question. I'm sure something simple is escaping me
--
and will come to me as soon as this hits the server. Googled into the
wee
hours with no success.

Thanks for any help --

Blue

so what have you got so far?

SELECT max( fieldname ) - min( fieldname )
FROM table
I had tried that, but it didn't return the value I thought it should.
There must have been another problem with it, as it's working now --

Thank you so much --

Blue


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.