 |
|
 |
|
Next: Cannot add new Database Diagrams
|
| Author |
Message |
External

Since: Dec 22, 2005 Posts: 3
|
(Msg. 1) Posted: Thu Dec 22, 2005 8:34 pm
Post subject: greatest value bounded above? Archived from groups: mailing>database>mysql (more info?)
|
|
|
Hi, I'm looking for an efficient way to do the following:
"given a column of entries with double values, select the greatest
value less than D", where D is given as the upper bound.
so if I have 0.1, 1.4, 10.11, 5.5 etc. then for D = 5, i should get
1.4.
My current solution stores all entries in an array and sorts them...
which I know is very very very inefficient. >> Stay informed about: greatest value bounded above? |
|
| Back to top |
|
 |  |
External

Since: Dec 22, 2005 Posts: 3
|
(Msg. 2) Posted: Thu Dec 22, 2005 9:43 pm
Post subject: Re: greatest value bounded above? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
stupid stupid me!:
select * from TABLE where value>0.0 and value<D order by value desc
limit 1;
ok, this works for me. thanks for reading!!!!
Shark wrote:
> Hi, I'm looking for an efficient way to do the following:
>
> "given a column of entries with double values, select the greatest
> value less than D", where D is given as the upper bound.
>
> so if I have 0.1, 1.4, 10.11, 5.5 etc. then for D = 5, i should get
> 1.4.
>
> My current solution stores all entries in an array and sorts them...
> which I know is very very very inefficient. >> Stay informed about: greatest value bounded above? |
|
| Back to top |
|
 |  |
External

Since: Oct 26, 2005 Posts: 4
|
(Msg. 3) Posted: Sat Dec 24, 2005 10:55 am
Post subject: Re: greatest value bounded above? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
SELECT
MAX(Number)
FROM
NUMBERS
WHERE
Number < 5
Rich
"Shark" wrote in message
> Hi, I'm looking for an efficient way to do the following:
>
> "given a column of entries with double values, select the greatest
> value less than D", where D is given as the upper bound.
>
> so if I have 0.1, 1.4, 10.11, 5.5 etc. then for D = 5, i should get
> 1.4.
>
> My current solution stores all entries in an array and sorts them...
> which I know is very very very inefficient.
> >> Stay informed about: greatest value bounded above? |
|
| Back to top |
|
 |  |
| Related Topics: | how to accept a databasename in the input parameters of a .. - hi,all: I had used mysql procedure many times before, while how to accept databasename in the inputparams stll is puzzled. for instance: create procedure sync_data_from_old_db(old_db varchar(10), new_db varchar(10)) insert into old_db.[tablename]..
MySQL client crashes with segmentation fault on Red Hat Li.. - Hi all, I don't know what I'm missing here, but if anyone could help me out I'd really appreciate it. Basically, everything is fine, compiles, installs, server runs, but the interactive mysql client breaks. I have an IA64 Red Hat Linux Enterprise..
DBI with mysqld - Hi everybody. Can I use DBI to interface Perl with mysqld running locally rather than with a 'true' MySQL server? If not DBI, how can I do this? aTdHvAaNnKcSe -- JAY VOLLMER JVOLLMER@VISI.COM
add primary keys to a table one-time and there are already - Is it possible to add primary keys to a table one-time and there are already multiple primary key defined? I have to change sp_id, so_id as primary keys to the existing primary keys dn_slot_id and dn_mm_id. I tried several times but all failed: 1. alte...
Data types when using Access with MySQL - I want to use MS Accesss as a front end for an existing MySQL database. Since Acceess doesn't have the same data types, eg. ENUM, am I tied to the smaller subset of types supported by Access? I'm assuming I have to duplicate the MySQL schema within Acces... |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|