Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

PHP Get count

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

PHP Get count

Postby durgaprasadcs » Thu Mar 27, 2014 11:37 am

Hi all,

I have records in my sql database which contains fields like ID, Name, Date
I need Name Count grouped by Month using date field.

Example :
ID | Name | Date (mm/dd/yyyy)
1 John 01/01/2013
2 David 01/20/2013
3 Harry 02/10/2013

So when i get the count based on the above data, if should be like follow

January - 2
February - 1

That is John and David falling in January Month
Harry is falling in February Month

How can i acheive this. Its like kind of excel pivot table.
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Mar 27, 2014 11:26 am

Re: PHP Get count

Postby raphael75 » Mon Mar 31, 2014 10:59 am

something like:

Code: Select all
  count(id) as 'total',
  monthname(date) as 'month'
group by
order by
  total desc
New php-forum User
New php-forum User
Posts: 20
Joined: Fri Apr 06, 2012 9:54 pm

Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.