Hello.
Search in the archives at:
http://lists.mysql.com/mysql
BETWEEN is meant among other operators at:
http://dev.mysql.com/doc/mysql/en/using-date.html
But be aware of that when you're using a datetime columns the query:
SELECT a from b WHERE a BETWEEN '2005-01-01' and '2005
On 07/10/2005, Erfan Shirazi wrote:
> It works fine, no errors and it seems to get correct data but the
> mysql manual and some other books doesn't mention anything about
> BETWEEN being used like this and therefor I'm not completely sure,
> anybody with any experience with my example?
I regularl
It works fine, no errors and it seems to get correct data but the mysql
manual and some other books doesn't mention anything about BETWEEN being
used like this and therefor I'm not completely sure, anybody with any
experience with my example?
Erfan Shirazi
Application Developer, Information Te
On 07/10/2005, Erfan Shirazi wrote:
> I have a question about BETWEEN.
> Could it be used to look up fields which have a date between to date
> fields?
>
> Ex: '2005-10-07' BETWEEN tEffectivedate AND tExpirationdate
>
> tEffectivedate and tExpirationdate are DATE types.
What happened when you t
Craig-
are you sure you want to test
ranking_id < '10' ???
-martin
- Original Message -
From: "Craig Hoffman" <[EMAIL PROTECTED]>
To: "MySQL" <[EMAIL PROTECTED]>
Sent: Friday, July 09, 2004 3:51 PM
Subject: Re: Between Operator
> Than
At 05:51 PM 7/9/2004, you wrote:
Thanks everyone for helping out.I took Michael's advice and made a
new table called ranking and two columns. It defiantly cleared some
things up but I am still having issues using the BETWEEN operator. I
just need to pull up everything BETWEEEN 10 and 18 a
Thanks everyone for helping out.I took Michael's advice and made a
new table called ranking and two columns. It defiantly cleared some
things up but I am still having issues using the BETWEEN operator. I
just need to pull up everything BETWEEEN 10 and 18 and it keeps adding
additional ro
On Fri, Jul 09, 2004 at 09:39:02AM -0500, Craig Hoffman wrote:
> Style: Traditional
> Area: Yosemite
> Rating: From: 5.5 To: 5.10c
...
> "SELECT * FROM routes, users WHERE area='$area' AND style='$style'
> BETWEEN rating='[$rating1]' AND rating='[$rating2]' GROUP BY route
> ORDER BY rating ASC
On Fri, 09 Jul 2004 11:38:05 -0400, Keith Ivey <[EMAIL PROTECTED]>
wrote:
Craig Hoffman wrote:
This should pull up all the rock climbs that are in Yosemite, that are
traditional style and are between the rating 5.5 to 5.10c. Here is my
query:
"SELECT * FROM routes, users WHERE area='$area'
Craig Hoffman wrote:
This should pull up all the rock climbs that are in Yosemite, that are
traditional style and are between the rating 5.5 to 5.10c. Here is my
query:
"SELECT * FROM routes, users WHERE area='$area' AND style='$style'
BETWEEN rating='[$rating1]' AND rating='[$rating2]' GROUP
: Andy Eastham [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 20, 2004 10:12 AM
To: Mysql List
Subject: RE: BETWEEN
Max,
You can measure the elapsed time by writing a linux shell script to do
the
inserts, then use the linux "time" command to run it. However, the user
and
system times disp
On Tue, Apr 20, 2004 at 08:28:54AM -0500, Boyd E. Hemphill wrote:
> Max:
>
> Thanks for the tip.
>
> Unfortunately I am not using a FreeBSD environment. My options are to
> either run a WinXP client remotely or to run something Linux based in a
> terminal emulator (Putty).
But that URL says "I
lisecond. Of course, getting the timestamp
takes a finite amount of time, which you may want to measure.
Andy
-Original Message-
From: Boyd E. Hemphill [mailto:[EMAIL PROTECTED]
Sent: 20 April 2004 14:29
To: 'Max Michaels'; 'mysql'
Subject: RE: BETWEEN
Max:
Thanks for
.
www.triand.com
O: (512) 248-2287
M: (713) 252-4688
-Original Message-
From: Max Michaels [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 20, 2004 7:07 AM
To: 'Boyd E. Hemphill'; 'mysql'
Subject: RE: BETWEEN
>
>Hello:
>
>I am trying to measure the di
>
>Hello:
>
>I am trying to measure the difference between a single insert statement of
10,000 rows and 10,000 insert statements.
>
>It is easy for me to see the single statement takes about 2 seconds.
>However I can come up with no good way to get the total time for individual
statements.
>
>Can
Hello:
I am trying to measure the difference between a single insert statement
of 10,000 rows and 10,000 insert statements.
It is easy for me to see the single statement takes about 2 seconds.
However I can come up with no good way to get the total time for
individual statements.
Can anyone pr
Matt W wrote:
Hi Michael,
http://www.mysql.com/doc/en/MySQL_indexes.html - Under the example
"WHERE clauses that use indexes":
/* index = 1 OR index = 2 */
... WHERE index=1 OR A=10 AND index=2
And for clarity, that should really have parentheses: index=1 OR (A=10
AND index=2)
Thanks for po
Hi Michael, Jochem,
- Original Message -
From: "Michael Stassen"
Sent: Tuesday, March 16, 2004 10:00 AM
Subject: Re: BETWEEN
>
> Jochem van Dieten wrote:
>
> > However, I expect that would result in doing 2 rangescans and a
> > merge. It might be even f
Hi Michael,
- Original Message -
From: "Michael Stassen"
Sent: Tuesday, March 16, 2004 9:45 AM
Subject: Re: BETWEEN
>
> Matt W wrote:
> >
> > The query using 2 BETWEENs with OR is exactly how it should be. It
will
> > be fast even in MySQL 3.23. OR
Michael Stassen wrote:
Jochem van Dieten wrote:
However, I expect that would result in doing 2 rangescans and a
merge. It might be even faster to use:
SELECT * FROM sys
WHERE sectorID BETWEEN 1 AND 42
AND sectorID NOT BETWEEN 21 AND 29;
That would result in 1 rangescan and a filter. But a lot de
Jochem van Dieten wrote:
Michael Stassen wrote:
SELECT * FROM sys
WHERE sectorID BETWEEN 1 AND 20
OR sectorID BETWEEN 30 AND 42;
If that's slow (the optimizer doesn't like ORs) and you are using at
least mysql 4.0.0, you can change this to
SELECT * FROM sys WHERE sectorID BETWEEN 1 AND 20
UN
Matt W wrote:
Hi Michael,
SELECT * FROM sys
WHERE sectorID BETWEEN 1 AND 20
OR sectorID BETWEEN 30 AND 42;
If that's slow (the optimizer doesn't like ORs) and you are using at
least mysql 4.0.0, you can change this to
SELECT * FROM sys WHERE sectorID BETWEEN 1 AND 20
UNION
SELECT * FROM sys WHE
Hi Michael,
- Original Message -
From: "Michael Stassen"
Sent: Saturday, March 13, 2004 10:48 AM
Subject: Re: BETWEEN
>
> Keith wrote:
>
> > g'day,
> >
> > i'm looking for a way to do two BETWEEN ranges. Currently I have
> > sys.
Keith writes:
>i'm looking for a way to do two BETWEEN ranges. Currently I have
>sys.sectorID BETWEEN 1 AND 20 but I want it so that I can search
>between 1 and 20 and also between 30 and 42 but all my efforts net
>an error and the manual doesn't go into a lot of detail. If there's
>a faster way th
Michael Stassen wrote:
SELECT * FROM sys
WHERE sectorID BETWEEN 1 AND 20
OR sectorID BETWEEN 30 AND 42;
If that's slow (the optimizer doesn't like ORs) and you are using at
least mysql 4.0.0, you can change this to
SELECT * FROM sys WHERE sectorID BETWEEN 1 AND 20
UNION
SELECT * FROM sys WHERE
Have you tried connecting the 'between' clauses with 'OR'?
Like this:
select *
from table
where sector_id between 1 and 20
or sector_id between 30 and 42
This approach works in my 4.0.15 MySQL database.
Rhino
- Original Message -
From: "Keith" <[EMAIL PROTECTED]>
To: "mysql" <[EMAIL P
Keith wrote:
g'day,
i'm looking for a way to do two BETWEEN ranges. Currently I have
sys.sectorID BETWEEN 1 AND 20 but I want it so that I can search between
1 and 20 and also between 30 and 42 but all my efforts net an error and
the manual doesn't go into a lot of detail. If there's a faster way
Yes...
Does it work?
- Original Message -
From: "Bob Ramsey" <[EMAIL PROTECTED]>
To: "Lingua2001" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 22, 2003 10:57 AM
Subject: Re: "between A and B" with another condit
Lingua2001 wrote:
How can I extract values for "members whose level is below '3', and
their names are between the alphabets 'a' and 'b' "?
For example, one of the results should be 'Alex', whose level is '1'.
Or 'Bob', whose level is '2'. But not Charlie, or Tom...etc.
I tried a query like
SELECT
Like this?
mysql> select * from t2;
+-++
| name| number |
+-++
| bob | 3 |
| bob | 2 |
| bob | 1 |
| al | 1 |
| al | 2 |
| al | 3 |
| al | 4 |
| adam| 4 |
| adam| 3 |
| adam
Hi,
On Tue, Jul 22, 2003 at 02:37:14AM -0500, Lingua2001 wrote:
> How can I extract values for "members whose level is below '3', and
> their names are between the alphabets 'a' and 'b' "?
> For example, one of the results should be 'Alex', whose level is '1'.
> Or 'Bob', whose level is '2'. But n
- Original Message -
From: "Lingua2001" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 22, 2003 10:37 AM
Subject: "between A and B" with another condition?
> Hi there,
>
> How can I extract values for "members whose level is below '3', and
> their names are between the a
> sql,query
Would it be possible to supply BETWEEN in any order (or rather to allow to do that)?
Such as
WHERE timestamp BETWEEN 2002100100 AND 20021031235959
would get the same results with
WHERE timestamp BETWEEN 20021031235959 AND 2002100100
or any other case where BETWEEN can be u
> So I do:
> SELECT * FROM table1 WHERE datum BETWEEN ('-00-00' + INTERVAL 1 DAY)
AND '2002-03-10';
> MySQL returns an empty result set, but it shouldn't (the table contains
dates year 2000 and up.
MySQL refers to the date -00-00 as null. Null+1 is null. Why don't you
rewrite the query
> Hi
>
> In mysql I found a problem with between query.
>
> For example
> select * from bugdetail where
> dbugcreate_date between from_days(to_days('2002-03-01')) and
> from_days(to_days('2002-03-04'))
>
> this query shows only those records up to '2002-03-03' instead of
> '2002-03-04'
Are all
Why you don't try:
BETWEEN '$surname_from' AND concat($surname_to,'z') ?
Makis
> -Original Message-
> From: Craig Shepherd [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 05, 2002 1:30 PM
> To: [EMAIL PROTECTED]
> Subject: BETWEEN... LIKE query
>
>
> Hi,
>
> I have a form with two
49
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: BETWEEN... LIKE query
>
>
> * Craig Shepherd
> > select * from consumers surname BETWEEN '$surname_from' AND
> '$surname_to'
> >
> > assume $surname_from = A and $surname_to = B
&g
* Craig Shepherd
> select * from consumers surname BETWEEN '$surname_from' AND '$surname_to'
>
> assume $surname_from = A and $surname_to = B
>
> would only return results where the surname is A or greater but
> less than B, but I would like to include all records where records
> also start with B
At 5:03 PM -0700 9/4/01, Chad Berryman wrote:
>I am trying to create a MySQL SELECT statement using PHP where I am
>getting a filtered list back by a date in the database formatted as
>-mm-dd where the date falls between a one week window that is in
>constant motion.
>
>For example, take to
I get the same behavior, and parentheses don't make any difference.
As long as the min or max argument is a mathematical expression,
MySQL uses the second number in the expression as the argument, so
the BETWEEN clause below is the same as
BETWEEN (63000) AND (63000)
I tried this on 3.23.3
>
>Maybe you should try
>
>SELECT count(*) FROM bench WHERE year = 95 and
>-> value BETWEEN (0.7*63000) and (1.3*63000) ;
>
Hmm -- I thought, yes! But...
mysql> select count(*) from bench where year = 95 and
-> value between (0.7*63000) and (1.3*63000);
+--+
| count(*)
Maybe you should try
SELECT count(*) FROM bench WHERE year = 95 and
-> value BETWEEN (0.7*63000) and (1.3*63000) ;
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 03, 2001 3:53 AM
Subject: BETWEEN problem?
> Can anyone explain the fol
42 matches
Mail list logo