Questions about finding ranges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey there,

I have a range of records that represent different faults and different symptoms that I want to pull out of the database, and to find the records that are the closest within each range.

I am currently doing it with a barrage of if statements, but I am sure that this could be done faster and far more elegantly by using SQL

I have a range of conditions eg
Attainable rates:
0-500 KB/sec is very poor
500 - 1000 is marginal
1000- 3000 KB/sec is good

So the database may look like:
Type|Min|Max|Value
Attainable|0|500|" This rate is very poor"

and then SQL could go something like

SELECT * FROM table WHERE Type= "Attainable" AND Min LIKE $var


But that wouldn't work quite right I don't think.

But where it can get a bit more hairy is that I want to have a whole range of variables that are input from an entry table, and then it just finds the the vars that are the closest to what is searching for all the vars. The closest code I have seen doing something similar is where there it is finding if an IP is in a certain range.

Does that make sense? feel free to email me if you need more explanation.

It is kind of like a multi variable search engine, that is finding the root cause of the symptoms that are the very best fit given the multi-variables...

Thanks heaps for any assistance,
Aslan.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux