RE: [PHP-DB] FW: Selecting not on DB

2002-11-21 Thread John W. Holmes
 Hi there,
 
 I have a problem that I cannot seem to solve. I'm using MySql and
query
 it using PHP.
 
 I have create table ABC with field called number containing
(1,4,6,10)
 
 How is to select all number form 1 to 10 which are not
 in that field so the output somehow like this :
 
 ++
 | Number |
 ++
 |  2 |
 |  3 |
 |  5 |
 |  7 |
 |  8 |
 |  9 |
 ++
 

SELECT * FROM abc WHERE Number NOT BETWEEN 1 AND 10;

---John Holmes...



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




[PHP-DB] FW: Selecting not on DB

2002-11-20 Thread milisphp
Hi there,
 
I have a problem that I cannot seem to solve. I'm using MySql and query
it using PHP.
 
I have create table ABC with field called number containing (1,4,6,10)
 
How is to select all number form 1 to 10 which are not
in that field so the output somehow like this :
 
++
| Number |
++
|  2 |
|  3 |
|  5 |
|  7 |
|  8 |
|  9 |
++
 
Thanks, Hansen



Re: [PHP-DB] FW: Selecting not on DB

2002-11-20 Thread Ignatius Reilly
You could create an auxiliary table nb_1_10 containing a field nb with all
integers from 1 to 10

Then perform a SELECT join:

SELECT nb_1_10.*
FROM ABC, nb_1_10
WHERE nb_1_10.nb NOT IN ABC.number
AND  some condition that returns only one row from ABC - like here
(1,4,6,10) 

Ignatius

- Original Message -
From: milisphp [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 21, 2002 5:29 AM
Subject: [PHP-DB] FW: Selecting not on DB


 Hi there,

 I have a problem that I cannot seem to solve. I'm using MySql and query
 it using PHP.

 I have create table ABC with field called number containing (1,4,6,10)

 How is to select all number form 1 to 10 which are not
 in that field so the output somehow like this :

 ++
 | Number |
 ++
 |  2 |
 |  3 |
 |  5 |
 |  7 |
 |  8 |
 |  9 |
 ++

 Thanks, Hansen



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