obaid
obaid

Reputation: 902

Convert Date to UnixTimeStamp in MySQL gives error LIMIT 0, 25

I have Dates Table in which one of the field name is START_DATE (DATE) type

My Query is:

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

I used SNO=1 because I want to fetch only one UnixTimeStamp value but the above query gives error as follows

**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

Upvotes: 1

Views: 229

Answers (1)

obaid
obaid

Reputation: 902

Instead of nested query I have used this query-

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

Upvotes: 1

Related Questions