-----Original Message-----
From: Richard Whitney [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 15, 2005 10:54 AM
To: Jay Blanchard
Subject: RE: SELECT assistance


Quoting Jay Blanchard <[EMAIL PROTECTED]>:

> [snip]
> I have a table containing three columns:
>
>  Int   int            int
> +----+-------------+------------+
> | id | serialbegin | serialend  |
> +----+-------------+------------+
> |  1 | 10          | 20         |
> +----+-------------+------------+
>
>
> And say we have serial number 11.
>
> Is there a way to SELECT any rows where $my_serial is greater
than/equal
> to
> serialbegin and less than/equal to serialend?
>
> I tried this query:
>
> SELECT id FROM numbers WHERE serialbegin >= '11' AND serialend <=
'11';
> [/snip]
>
> Since they appear to be INT types, drop the single quotes...
>
Change:

SELECT id FROM numbers WHERE serialbegin >= 11 AND serialend <= 11;
(will return an empty resultset)
To:

SELECT id FROM numbers WHERE serialbegin <= 11 AND serialend >= 11;


R. Whitney
Transcend Development
"Producing the next phase of your internet presence"
http://xend.net
Premium Quality Web Hosting
http://xendhosting.com
rw AT xend.net
Net Binder  http://netbinder.net
310-943-6498
602-288-5340


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to