SELECT FROM_UNIXTIME(date_of_registration, '%Y-%m-%d %H:%i:%s') AS user_registeredon,
FROM_UNIXTIME(renewal_date, '%Y-%m-%d %H:%i:%s') AS expiry_date,
a.agent_id
FROM ta_agent a,
ta_subscription s
WHERE s.agent_id = a.agent_id
我的输出
我想以天数显示到期日。例如:69天过期。如何将bigint转换为天数?
答案 0 :(得分:1)
SELECT FROM_UNIXTIME(date_of_registration, '%Y-%m-%d %H:%i:%s') AS user_registeredon,
ROUND((renewal_date - date_of_registration)/(60*60*24)) AS expiry_date,
a.agent_id
FROM ta_agent a,
ta_subscription s
WHERE s.agent_id = a.agent_id