Date: 06/14/05 (MySQL Communtiy) Keywords: php, mysql, sql I've been wrestling with this query all afternoon. I've read the MySQL docs and got some help from the PHP LJ group, but now I'm totally stuck. SELECT nuke_project_milestones.start_date, nuke_project_milestones.length_num, nuke_project_milestones.length_type, date_add(nuke_project_milestones.start_date, INTERVAL nuke_project_milestones.length_num nuke_project_milestones.length_type) AS estfinish FROM nuke_project_milestones To my mostly untrained eyes, it looks okay, but when I run it, I get this error: #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 'nuke_project_milestones.length_type) AS estfinish FROM nuke_pro Poking and prodding around leads me to believe it has something to do with the length_type variable, which is a 5-character varchar, which I set through my PHP script to be DAY, MONTH, or YEAR. So, in short, what am I doing wrong? (With this query, anyway.) Source: http://www.livejournal.com/community/mysql/59772.html
|