I have a problem with a query in Mysql.
In my table stored access for period.
My table cloumns are
-account_id (primaty key)
-years (primaty key)
-month (primaty key)
account_id_A 2012 03 12
account_id_A 2012 04 15
account_id_A 2013 04 10
account_id_B 2012 03 12
account_id_B 2012 04 15
account_id_B 2013 03 7
I need to create a query to extract:
account_id, total number of access in 2012, total number of access in 2013.
I'm unable to prepare query in a correct way.
This will work for you:
select account_id, years , month , SUM(access_numbe)
GROUP by account_id, years
I have suggestion that
select account_id, years from MyTable GROUP by account_id, years
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)