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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -