RE: [PHP-DB] Getting valie between two fields? (mysql)

2002-10-16 Thread Ryan Jameson (USA)

Ooopss 2 answers is better than none. :-) ...

James, can I have a free database too? Just kidding... it's cool you offered.

<>< Ryan

-Original Message-
From: Ryan Jameson (USA) 
Sent: Wednesday, October 16, 2002 11:19 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Getting valie between two fields? (mysql)


select number from table where number < 30 
order by number desc 
limit 1

<>< Ryan

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 16, 2002 11:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Getting valie between two fields? (mysql)


I have a table something like this:
__
| id | number |
| 1 |   1 |
| 2 |  23|
| 3 |  59|
| 4 | 103   |

If I have a number, say 30, I need to get the last number it's above - 
in this case id 2.  Any ideas?

-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


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




RE: [PHP-DB] Getting valie between two fields? (mysql)

2002-10-16 Thread Ryan Jameson (USA)

select number from table where number < 30 
order by number desc 
limit 1

<>< Ryan

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 16, 2002 11:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Getting valie between two fields? (mysql)


I have a table something like this:
__
| id | number |
| 1 |   1 |
| 2 |  23|
| 3 |  59|
| 4 | 103   |

If I have a number, say 30, I need to get the last number it's above - 
in this case id 2.  Any ideas?

-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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




Re: [PHP-DB] Getting valie between two fields? (mysql)

2002-10-16 Thread 1LT John W. Holmes

> I have a table something like this:
> __
> | id | number |
> | 1 |   1 |
> | 2 |  23|
> | 3 |  59|
> | 4 | 103   |
> 
> If I have a number, say 30, I need to get the last number it's above - 
> in this case id 2.  Any ideas?

$number = 30;
SELECT id FROM table WHERE number < $number ORDER BY number DESC LIMIT 1;

---John Holmes...

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