开发者

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 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜