MySQL - reference column in function call
I got a number in a table, which I want to use for the DATE_ADD function in MySQL.
So something like this:
SELECT DATE_ADD(开发者_高级运维'2011-01-02', '+INTERVAL some_table.column DAY') AS newdate FROM some_table
This will however not work, as MySQL will not understand some_table.column is a column with a value etc. Any help please?
Don't use quotes:
SELECT DATE_ADD('2011-01-02', INTERVAL some_table.column) AS newdate FROM some_table
精彩评论