0

Hi Friends

I am working to draw a graph . I need to get the data monthly, for example JAN total hours FEB total hours ,

How to write the query get the total values per month?

Advance thanks for your reply.

2
Contributors
10
Replies
11
Views
8 Years
Discussion Span
Last Post by Shanti C
0

hi

Thanks for your reply

Table structure here

CREATE TABLE IF NOT EXISTS `invoice` (
  `id` int(11) NOT NULL auto_increment,
  `instance_id` int(11) NOT NULL default '0',
  `project_id` int(11) NOT NULL default '0',
  `user_id` int(11) NOT NULL default '0',
  `instance_category_tasks_master_id` int(11) NOT NULL default '0',
  `invoice_id` int(11) NOT NULL default '0',
  `hours` double(3,2) NOT NULL default '0.00',
  `date` date NOT NULL default '0000-00-00',
  `pay_rate` double(5,2) NOT NULL default '0.00',
  `bill_rate` double(5,2) NOT NULL default '0.00',
  `billable` enum('yes','no') NOT NULL default 'yes',
  `created_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `created_ipaddress` varchar(15) NOT NULL default '',
  `updated_date` date NOT NULL default '0000-00-00',
  `updated_ipaddress` varchar(15) NOT NULL default '',
  `active` char(3) NOT NULL default '',
  `timecard_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
)
0

I need the query for every month , I need the query to get the values every month.

Any Idea

0

hello see this example will help you:
t1 table having 4 columns like year,month,day,points...
year month day points
2000 01 01 1
2000 01 20 3
2000 01 02 5
2000 02 23 10

then here im calculting total point per month...
here is the query:

SELECT year,
MONTH , sum( points ) AS points
FROM t1
GROUP BY year,
MONTH

it will print:
year month points
2000 01 8
2000 02 15

0

i think you have to add one more column like month the you will calculate hours per month by using group by month column...

0

Yes I have checked and complete the task .Thanks for you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.