Re: Select Date Help
Thanks everyone for their help! Max Clark [EMAIL PROTECTED] wrote in message av2eai$8he$[EMAIL PROTECTED]">news:av2eai$8he$[EMAIL PROTECTED]... Hi all, I have a DATE column (CCYY-MM-DD), I would like to do a query like this: select * from table where date = '2003-01' What additional information do I need to provide for this query to work properly? Thanks in advance, Max - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Select Date Help
Hi all, I have a DATE column (CCYY-MM-DD), I would like to do a query like this: select * from table where date = '2003-01' What additional information do I need to provide for this query to work properly? Thanks in advance, Max - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Select Date Help
Hi Max, You must enter this: SELECT * FROM your_table WHERE date LIKE 2003-01-%; I think that you can more read about LIKE at http://www.mysql.org Best Regards, Boris Penchev - Original Message - From: Max Clark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 03, 2003 12:27 AM Subject: Select Date Help Hi all, I have a DATE column (CCYY-MM-DD), I would like to do a query like this: select * from table where date = '2003-01' What additional information do I need to provide for this query to work properly? Thanks in advance, Max - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Select Date Help
On 2 Jan 2003, at 14:27, Max Clark wrote: I have a DATE column (CCYY-MM-DD), I would like to do a query like this: select * from table where date = '2003-01' What additional information do I need to provide for this query to work properly? You need to explain to us what result you expect. Since '2003-01' is not a complete date, your criterion will never be met. Maybe you want something like this? SELECT * FROM table_name WHERE date BETWEEN '2003-01-01' AND '2003-01-31'; -- Keith C. Ivey [EMAIL PROTECTED] Tobacco Documents Online http://tobaccodocuments.org Phone 202-667-6653 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Select Date Help
On Thu, 2 Jan 2003 14:27:25 -0800, Max Clark wrote: select * from table where date = '2003-01' aside from ...where (date='2003-01-01' and date = '2003-01-31') I think you could use ...where left(date,7) = '2003-01' http://www.mysql.com/doc/en/Date_calculations.html - Steve Yates - To know recursion, you must first know recursion. ~ Taglines by Taglinator - www.srtware.com ~ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Select Date Help
I think you could also use: WHERE YEAR(date) = 2003 AND MONTH(date) = 01 -Original Message- From: Keith C. Ivey [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 5:09 PM To: [EMAIL PROTECTED] Cc: Max Clark Subject: Re: Select Date Help On 2 Jan 2003, at 14:27, Max Clark wrote: I have a DATE column (CCYY-MM-DD), I would like to do a query like this: select * from table where date = '2003-01' What additional information do I need to provide for this query to work properly? You need to explain to us what result you expect. Since '2003-01' is not a complete date, your criterion will never be met. Maybe you want something like this? SELECT * FROM table_name WHERE date BETWEEN '2003-01-01' AND '2003-01-31'; -- Keith C. Ivey [EMAIL PROTECTED] Tobacco Documents Online http://tobaccodocuments.org Phone 202-667-6653 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Select DATE, help ...
* Tom Jones I have a table with 2 columns StartDate and EndDate. I can't seem to figure out how to write a select statement that will tell me if the date I'm searching on is between the Start and the End date. Like, I want to know if 7/4/2002 is between 6/1/2002 (startDate) and 8/1/2002 (endDate). Take a look at the BETWEEN operator: URL: http://www.mysql.com/doc/C/o/Comparison_Operators.html Something like this: SELECT * FROM MyTable WHERE '2002-07-04' BETWEEN startDate AND endDate; -- Roger - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Select DATE, help ...
On Wednesday, June 5, 2002, at 10:03 PM, [EMAIL PROTECTED] wrote: Your message cannot be posted because it appears to be either spam or simply off topic to our filter. To bypass the filter you must include one of the following words in your message: sql,query If you just reply to this message, and include the entire text of it in the reply, your reply will go through. However, you should first review the text of the message to make sure it has something to do with MySQL. Just typing the word MySQL once will be sufficient, for example. You have written the following: Hello, I have a table with 2 columns StartDate and EndDate. I can't seem to figure out how to write a select statement that will tell me if the date I'm searching on is between the Start and the End date. Like, I want to know if 7/4/2002 is between 6/1/2002 (startDate) and 8/1/2002 (endDate). Thanks, - Tom - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php