mysql - Select data where datetime is less than 30 days -
i have freeradius-mysql query select data acctstarttime more 30 days:
below query:
select sum(acctinputoctets - greatest((30 - unix_timestamp(acctstarttime)), 0)) + sum(acctoutputoctets - greatest((30 - unix_timestamp(acctstarttime)), 0)) radacct username = 'user2' , unix_timestamp(acctstarttime) + acctsessiontime > 30
i have query of same nature selects data acctstarttime less 30 days , im having hard time.
can help?
try this:
select acctstarttime radacct acctstarttime < adddate(acctstarttime, interval 30 day)
for more info , functions: date , time functions
Comments
Post a Comment