How to count per day insert row in mysql

Posted by Shubham under Sql Server on 12/29/2012 | Points: 10 | Views : 1613 | Status : [Member] | Replies : 5
is any type of query which provides per day count of inserted row in mysql

like
name , id, address
name , id, address
name , id, address
name , id, address
if inserted 4 time in current day so query will show today inserted column is 4

Thanks&Regards:-
Shubham Choudhary
Software Engineer
www.facebook.com/shubham.kunar



Responses

Posted by: Pavanandey on: 12/31/2012 [Member] Bronze | Points: 25

Up
0
Down
maintain a date column and you can calculate the no of rows inserted.



Thanks
Pavan Kumar
Mark Answer if this fits the need

Shubham, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/31/2012 [Member] Bronze | Points: 25

Up
0
Down
declare a global variable count and date.
write a trigger on the table such a way that increment the count variable value on every insert and reset the count variable on every date change

Thanks
Pavan Kumar
Mark Answer if this fits the need

Shubham, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/31/2012 [Member] Bronze | Points: 25

Up
0
Down
Mark answer if this helps you

Thanks
Pavan Kumar
Mark Answer if this fits the need

Shubham, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Baimey on: 12/31/2012 [Member] Starter | Points: 25

Up
0
Down
use a calendar table to join on

SELECT
calendar.calendar_date,
COUNT(*)
FROM
calendar
LEFT JOIN
yourData
ON yourData.timeStamp >= calendar.calendar_date
AND yourData.timeStamp < calendar.calendar_date + 1
WHERE
calendar.calendar_date >= '01 Jan 2012'
AND calendar.calendar_date < '04 Jan 2012'
GROUP BY
calendar.calendar_date

Please Mark as Answer If this Helps

Shubham, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Baimey on: 12/31/2012 [Member] Starter | Points: 25

Up
0
Down
For more clarification please check the forum
http://stackoverflow.com/questions/9499262/how-to-group-number-of-rows-per-day-also-in-no-row-days-in-mysql


Please Mark as Answer If this Helps

Shubham, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response