SELECT by day
am 29.09.2009 15:04:05 von Kerstin Finke
Hi,
I want to search all rows with datum = 'tuesday' for example, something
like:
SELECT * FROM `table_anw` WHERE datum=DAYOFWEEK(3);
'3' as tuesday.
I found in the manual I can do:
SELECT DAYOFWEEK('1998-02-03');
and will get '3' for Tuesday.
But thats not what I want. I want to select only tuesdays.
Any ideas?
Thanks in advance
Kerstin
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
Re: SELECT by day
am 29.09.2009 21:22:27 von joao
Have you tried this?
SELECT * FROM `table_anw` WHERE DAYOFWEEK(datum) = 3;
"Kerstin Finke" escreveu na mensagem
news:20090929130406.9802.qmail@lists.mysql.com...
> Hi,
> I want to search all rows with datum = 'tuesday' for example, something
> like:
>
> SELECT * FROM `table_anw` WHERE datum=DAYOFWEEK(3);
> '3' as tuesday.
>
> I found in the manual I can do:
> SELECT DAYOFWEEK('1998-02-03');
> and will get '3' for Tuesday.
>
> But thats not what I want. I want to select only tuesdays.
> Any ideas?
>
> Thanks in advance
> Kerstin
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: SELECT by day
am 29.09.2009 21:25:36 von Scott Swaim
Try this
SELECT * FROM `table_anw` WHERE DAYOFWEEK(datum) = 3;
Scott Swaim
I.T. Director
Total Care / Joshua Family Medical Care
(817) 297-4455
Website: www.totalcareclinic.com
NOTICE: The information contained in this e-mail is privileged and
confidential and is intended for the exclusive use of the recipient(s) named
above. If you are not the intended recipient or his or her agent, you are
hereby notified that you have received this document in error and that any
use, disclosure, dissemination, distribution, or copying of this message is
prohibited. If you have received this communication in error, please notify
the sender immediately by e-mail, and delete the original message
-----Original Message-----
From: Kerstin Finke [mailto:kerstinfinke@hotmail.com]
Sent: Tuesday, September 29, 2009 8:04 AM
To: mysql@lists.mysql.com
Subject: SELECT by day
Hi,
I want to search all rows with datum = 'tuesday' for example, something
like:
SELECT * FROM `table_anw` WHERE datum=DAYOFWEEK(3);
'3' as tuesday.
I found in the manual I can do:
SELECT DAYOFWEEK('1998-02-03');
and will get '3' for Tuesday.
But thats not what I want. I want to select only tuesdays.
Any ideas?
Thanks in advance
Kerstin
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=scott@tmcclinic.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: SELECT by day
am 29.09.2009 21:34:39 von Rolando Edwards
SELECT * FROM `table_anw` WHERE DAYOFWEEK(datum) =3D 3;
SELECT * FROM `table_anw` WHERE WEEKDAY(datum) =3D 2;=20
SELECT * FROM `table_anw` WHERE DAYNAME(datum) =3D 'Tuesday';
SELECT * FROM `table_anw` WHERE DATE_FORMAT(datum,'%W') =3D 'Tuesday';
SELECT * FROM `table_anw` WHERE DATE_FORMAT(datum,'%a') =3D 'Tue';
DAYOFWEEK function begins back (1 for Sunday, 2 for Monday, ..., 7 for Satu=
rday) (See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functio ns.h=
tml#function_dayofweek)
WEEKDAY function begins back (0 for Sunday, 1 for Monday, ..., 6 for Saturd=
ay) (See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functio ns.htm=
l#function_weekday)
DAYNAME brings back day of week fully spelled out (Sunday,Monday,Tuesday,We=
dnesday,Thursday,Friday,Saturday) (See http://dev.mysql.com/doc/refman/5.0/=
en/date-and-time-functions.html#function_dayname)
DATE_FORMAT using special metacharacters for date and time components (see =
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functio ns.html#functio=
n_date-format)
These queries should all bring back the same results where datum is a Tuesd=
ay
Give it a try !!!
Rolando A. Edwards
MySQL DBA (CMDBA)
155 Avenue of the Americas, Fifth Floor
New York, NY 10013
212-625-5307 (Work)
201-660-3221 (Cell)
AIM & Skype : RolandoLogicWorx
redwards@logicworks.net
http://www.linkedin.com/in/rolandoedwards
-----Original Message-----
From: Kerstin Finke [mailto:kerstinfinke@hotmail.com]=20
Sent: Tuesday, September 29, 2009 9:04 AM
To: mysql@lists.mysql.com
Subject: SELECT by day
Hi,
I want to search all rows with datum =3D 'tuesday' for example, something=20
like:
SELECT * FROM `table_anw` WHERE datum=3DDAYOFWEEK(3);
'3' as tuesday.
I found in the manual I can do:
SELECT DAYOFWEEK('1998-02-03');
and will get '3' for Tuesday.
But thats not what I want. I want to select only tuesdays.
Any ideas?
Thanks in advance
Kerstin
--=20
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dredwards@logicworks=
..net
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg