MySQL-获取剩余天数 [英] MySql - get days remaining

查看:504
本文介绍了MySQL-获取剩余天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户可以在指定的天数内(例如, 30天.

Users can sign up for a premium listing for a specified number of days, e.g. 30 days.

tblPremiumListings

user_id     days     created_date  
---------------------------------
1           30        2013-05-21
2           60        2013-06-21
3           120       2012-06-21

我该如何选择高级列表中还有剩余天数的记录.

How would I select records where there are still days remaining on a premium listing.

推荐答案

SELECT *
FROM tblPremiumListings
WHERE created_date + INTERVAL `days` DAY >= CURDATE()

这篇关于MySQL-获取剩余天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆