Hi Folks,
i've got a table like so..
bookings
(
start DATE
nights INT
)
And i want to query the table so that i receive the start date as a unix_timestamp and then the result of adding nights to start as a timestamp.
e.g.
SELECT
UNIX_TIMESTAMP(date) as 'start',
UNIX_TIMESTAMP(DATE_ADD(date, INTERVAL nights DAYS))
FROM
bookings_units
However, this won't work as mysql throws up and error..
You have an error in your SQL syntax near 'DAYS)) FROM bookings_units WHERE accom_id = '14' ' at line 3
MySQL does not like me using a field as the interval..
I realise that i can do "UNIX_TIMESTAMP(date) + (nights * 86400)". but was just wondering whether there was a cleaner way to do it...
Anyone got any ideas?