我的询问如下:
select id,
date
from table
where date < 1/31/2015 && date > 11/31/2011
我的询问如下:
select id,
date
from table
where date < 1/31/2015 && date > 11/31/2011
如果你提供显示日期,某些格式将暗中/自动地转换为比较该栏的适当数据类型。 IE:
SELECT t.id,
t.date
FROM TABLE t
WHERE t.date < 2015-01-31
AND t.date > 2011-11-31
将某一日期/时间改为DATETIME的最有效手段是使用:
WHERE t.date < STR_TO_DATE( 1/31/2015 , %m/%d/%Y )
AND t.date > STR_TO_DATE( 11/31/2011 , %m/%d/%Y )
缩略语 领域为<代码>。 YYYY-MM-DD HH:MM:SS。 如果你不使用处理日期的内在数据类型,你会再次遇到更多的麻烦。
Firstly, && is not the "and" operator in SQL; use AND.
第二,MySQL的日期总是ISO-8601。 我建议你阅读标准或研究一些实例。
第三,你可以利用“BETWEEN”的功能,在范围上找到价值。
I recommend reading
a) MySQL文件
b) 一些实例
而且
c) 参加了为开始者举办的培训课程。
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...
Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...
What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...