sql - How to count the number of rows pertaining to a certain year within a table -


i have table (named trxitemdata) contains on 40 columns , 60million rows. 1 of these columns, named activitydatedate shows date/year associated each customerid (another column in table).

what find number of rows allocated each year (2010,2011,etc), such table looks in results output:

year    number of rows 2011    100 2012    10000 2013    10000000 

i looking following code not familiar group clauses:

select count(*) trxitemdata group year(activitydatedate)  

however when run following table not sure means:

no column name 33060000 27546960 2941697 

any provide appreciated! thanks!

try

select year(activitydatedate) [year], count(1) [number of rows] trxitemdata group year(activitydatedate) order year(activitydatedate) 

does date column have "datedate"? :p


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -