In mysqlphp, SELECT * FROMuserORDERBYtimeWHEREtime & amp; gt; 1111-11-, an error is reported, while SELECT * FROMuserORDERBYtime and SELECT * FROMuserWHEREtime & amp; gt; 1111-11-are normal, why... mysql php
SELECT * FROM user ORDER BY time WHERE time >= 1111-11-11 10:10:10
An error is reported.
SELECT * FROM user ORDER BY time
And
SELECT * FROM user WHERE time >= 1111-11-11 10:10:10
All are normal. Why? Previously, I used to operate databases using thinkphp encapsulation. Recently I used Native mysql to write the database, and the database became stuck.
Reply content:
Mysql php
SELECT * FROM user ORDER BY time WHERE time >= 1111-11-11 10:10:10
An error is reported.
SELECT * FROM user ORDER BY time
AndSELECT * FROM user WHERE time >= 1111-11-11 10:10:10
All are normal. Why? Previously, I used to operate databases using thinkphp encapsulation. Recently I used Native mysql to write the database, and the database became stuck.
The logic order is wrong. How can I sort the data before conditional query? First query conditions and then ORDER
I used thinkphp to generate the final statement and checked the keyword order. The adjusted statement is as follows:SELECT * FROM
UserWHERE(
Time>= '2014-11-10 10:10:10') ORDER BY time
Running successfully