mysql : timestamp this month, last month and every month -


i have following mysql table

amount  timestamp 3       1367638029 4       1367638029 5       1366445119 8       1366445200 

how return sum(amount) based on month (not last 30 day) , last month below

            total amount month  7 last month  13 

this canbe done way:

select sum(amount) yourtable month(from_unixtime(timestamp)) in/between ... -- consider year(...)as group month(from_unixtime(timestamp)) 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -