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 > MySQL Query Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-02-10, 15:14
bloozerd bloozerd is offline
Registered User
 
Join Date: Jan 2010
Posts: 6
MySQL Query Problem

I have a table that contains tank data...(increment factors)

gauge - contains floating point data in 0.01 feet - primary key
multiplier - contains floating point data in volume per gauge
index - contains floating point data in volume at gauge

gauge - there is no gauge for every 0.01 feet...it is a reference point as follows:
gauge = 0.0 = no multiplier = 44.1345 index volume
gauge = 0.08 = 8.9035 = 115.7775

what this means is that from 0.0 to 0.8 you multiply 8.9035 times the number of gauge values then add it to the 0.0 index volume (44.1345 in this case) to get the actual volume at any of the intermediate gauges...

example:
gauge = 0.07
gauge value = (0.07 - 0.0) * 100 = 7
index volume @ 0.0 = 44.1345
7 * 8.9035 = 62.3245
44.1345 + 62.3245 = 106.459

I would like a query that will take an input gauge, calculate the gauge value, then calculate the index volume...!

The table can be modified if you think that a design change would be beneficial...!

Can anyone shed some light on this one...?
Reply With Quote
  #2 (permalink)  
Old 07-03-10, 00:46
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
look at the use of CASE, you will probably need a couple of separate conditions to do your calculations.
Reply With Quote
  #3 (permalink)  
Old 07-03-10, 05:27
bloozerd bloozerd is offline
Registered User
 
Join Date: Jan 2010
Posts: 6
Thanks...I have a look...!
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