开发者

SQL Function that uses a time-stamp to output how old a question is

I have a calculated field whose value I want to 开发者_StackOverflowmodify depending on how old the entry is. Is there way in MySQL to take a time stamp and use it to determine how old a query is.

Here is the calculated field

((ces.EXPERT_SCORE * cirm.CONSUMER_RATING) + (12.5 * scs.SIMILARITY)* (1 - EXP(-0.5 * (cal.TIPS_AMOUNT / ATV.AVG_TIPS)) + .15))AS ANSWER_SCORE

Basically, I want to multply this calculated field based on the age of a timestamp.


You can trivially convert a MySQL date/datetime field to an integer with UNIX_TIMESTAMP(), which'll give you the oldschool signed 32bit integer where 0 represents Jan 1/1970.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜