Error 1064 ... near ':30) interval 1 week etc

32 views Asked by At

I have used the following code successfully on one site and am trying to replicate it on another, but get the above error.

This was from a post on stackoverflow, but search as I might, I can't find the original, so apologies for creating a new question.

The various dates, week interval and limit are derived from form fields, so a user can generate the required number of dates with repeat pattern (e.g. 3 dates, one every week or 6 dates one every month).

The num tables has a single field, 'i', with rows 0-26

SELECT DATE_ADD(2015-01-01, interval @num := @num + 1 week) AS start_date,
 DATE_ADD(ADDTIME(2015-01-01, 01:30 ), interval @num week) AS end_date,    num.*
FROM num
WHERE num.i IS NOT NULL LIMIT 3

I'd be very grateful if someone could point out the glaringly obvious!

Thanks Chris

0

There are 0 answers