{"id":424,"date":"2012-12-31T09:04:50","date_gmt":"2012-12-31T09:04:50","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=424"},"modified":"2016-09-10T15:19:36","modified_gmt":"2016-09-10T15:19:36","slug":"query-for-website-site-counter-based-on-month","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/query-for-website-site-counter-based-on-month\/","title":{"rendered":"Query for website site counter based on month"},"content":{"rendered":"<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nCREATE TABLE ipaddress(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,\r\n                       date VARCHAR(255),\r\n                       ip VARCHAR(255));\r\n\r\nINSERT INTO ipaddress(date, ip)\r\n               VALUES('1-1-2012', '195.165.1.2'),\r\n                     ('1-1-2012', '195.165.1.3'),\r\n                     ('12-2-2012', '195.165.1.8');\r\n<\/pre>\n<p>Total number of Visits should be grouped based on IP Address<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT COUNT(ip), MONTHNAME(STR_TO_DATE(date, '%c-%e-%Y')) as period\r\n  FROM ipaddress\r\n GROUP BY period;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CREATE TABLE ipaddress(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, date VARCHAR(255), ip VARCHAR(255)); INSERT INTO ipaddress(date, ip) VALUES(&#8216;1-1-2012&#8217;, &#8216;195.165.1.2&#8217;), (&#8216;1-1-2012&#8217;, &#8216;195.165.1.3&#8217;), (&#8217;12-2-2012&#8242;, &#8216;195.165.1.8&#8217;); Total number of Visits should be grouped based on IP Address SELECT COUNT(ip), MONTHNAME(STR_TO_DATE(date, &#8216;%c-%e-%Y&#8217;)) as period FROM ipaddress GROUP BY period;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,20],"tags":[],"class_list":["post-424","post","type-post","status-publish","format-standard","hentry","category-mysql","category-queries"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=424"}],"version-history":[{"count":1,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/424\/revisions"}],"predecessor-version":[{"id":1607,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/424\/revisions\/1607"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}