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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -