在MySQL中将Date转换为UnixTimeStamp会产生错误LIMIT 0,25

时间:2017-02-14 07:55:09

标签: php mysql unix-timestamp

我有Dates Table,其中一个字段名称是START_DATE(DATE)类型

我的查询是:

SELECT UNIX_TIMESTAMP(SELECT START_DATE FROM `mobile_registrations_dates` WHERE SNO=1) 

我使用了SNO = 1,因为我只想获取一个UnixTimeStamp值,但上面的查询给出了如下错误

**Error**
SQL query:  

SELECT UNIX_TIMESTAMP(SELECT START_DATE FROM `mobile_registrations_dates` WHERE LIMIT 1) LIMIT 0, 25

MySQL said:  
#1064 - You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to 
use near 'SELECT START_DATE FROM `mobile_registrations_dates` WHERE LIMIT 1) 
LIMIT 0, 25' at line 1

1 个答案:

答案 0 :(得分:1)

我使用了这个查询 -

而不是嵌套查询
SELECT UNIX_TIMESTAMP(START_DATE) FROM `mobile_registrations_dates` WHERE SNO = 1