Re: Selecting Dates
On Jan 31, 2010, at 7:35 PM, ML wrote: > Hi All, > > Switching from Oracle to MySQL, I seem to be having some difficulty selecting > dates using between or even where >= and <= like: > > SELECT * FROM orders WHERE order_date BETWEEN='2010-01-01' AND '2010-01-30' > ORDER BY order_date; No "=" after BETWEEN. > > or > > SELECT * FROM orders WHERE order_date =>'2010-01-01' AND <= '2010-01-30' > ORDER BY order_date; Need "order_date <=", not just "<=". > > Neither of these work. > > What am I missing? > > -ML -- Paul DuBois Sun Microsystems / MySQL Documentation Team Madison, Wisconsin, USA www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Selecting Dates
Jim, > Shouldn't it be: > SELECT * FROM orders WHERE order_date >= '2010-01-01' AND order_date <= > '2010-01-30' ORDER BY order_date; > > ? > > change the "=>" and repeat the column_name. Datetime should be datetime or > timestamp; Spot on. Thank you for the clarification, obviously a syntax mistake on my part. -ML -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Selecting Dates
Shouldn't it be: SELECT * FROM orders WHERE order_date >= '2010-01-01' AND order_date <= '2010-01-30' ORDER BY order_date; ? change the "=>" and repeat the column_name. Datetime should be datetime or timestamp; On Mon, Feb 1, 2010 at 8:25 AM, wrote: > Hi > What is the datatype of the column order_date. Give the full form of the > date for the between condition. > > Thanks > Suresh Kuna > MySQL DBA > --Original Message-- > From: ML > To: mysql@lists.mysql.com > Subject: Selecting Dates > Sent: Feb 1, 2010 7:05 AM > > Hi All, > > Switching from Oracle to MySQL, I seem to be having some difficulty > selecting dates using between or even where >= and <= like: > > SELECT * FROM orders WHERE order_date BETWEEN='2010-01-01' AND '2010-01-30' > ORDER BY order_date; > > or > > SELECT * FROM orders WHERE order_date =>'2010-01-01' AND <= '2010-01-30' > ORDER BY order_date; > > Neither of these work. > > What am I missing? > > -ML > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/mysql?unsub=sureshkumar...@gmail.com > > > > Sent from BlackBerry® on Airtel -- Jim Lyons Web developer / Database administrator http://www.weblyons.com
Re: Selecting Dates
Hi What is the datatype of the column order_date. Give the full form of the date for the between condition. Thanks Suresh Kuna MySQL DBA --Original Message-- From: ML To: mysql@lists.mysql.com Subject: Selecting Dates Sent: Feb 1, 2010 7:05 AM Hi All, Switching from Oracle to MySQL, I seem to be having some difficulty selecting dates using between or even where >= and <= like: SELECT * FROM orders WHERE order_date BETWEEN='2010-01-01' AND '2010-01-30' ORDER BY order_date; or SELECT * FROM orders WHERE order_date =>'2010-01-01' AND <= '2010-01-30' ORDER BY order_date; Neither of these work. What am I missing? -ML -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=sureshkumar...@gmail.com Sent from BlackBerry® on Airtel
Re: Selecting Dates
Just trying to help. SELECT * FROM orders WHERE order_date BETWEEN '2010-01-01' AND '2010-01-30' ORDER BY order_date; or SELECT * FROM orders WHERE order_date >= '2010-01-01' AND <= '2010-01-30' ORDER BY order_date; From: ML To: mysql@lists.mysql.com Sent: Mon, February 1, 2010 8:35:01 AM Subject: Selecting Dates Hi All, Switching from Oracle to MySQL, I seem to be having some difficulty selecting dates using between or even where >= and <= like: SELECT * FROM orders WHERE order_date BETWEEN='2010-01-01' AND '2010-01-30' ORDER BY order_date; or SELECT * FROM orders WHERE order_date =>'2010-01-01' AND <= '2010-01-30' ORDER BY order_date; Neither of these work. What am I missing? -ML -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=luckyx_cool_...@yahoo.com
Selecting Dates
Hi All, Switching from Oracle to MySQL, I seem to be having some difficulty selecting dates using between or even where >= and <= like: SELECT * FROM orders WHERE order_date BETWEEN='2010-01-01' AND '2010-01-30' ORDER BY order_date; or SELECT * FROM orders WHERE order_date =>'2010-01-01' AND <= '2010-01-30' ORDER BY order_date; Neither of these work. What am I missing? -ML -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org