troubleshooting Question

get distinct list of mysql records filter by ip.date and page/query

Avatar of Johnny
JohnnyFlag for United States of America asked on
PHPMySQL Server
12 Comments1 Solution711 ViewsLast Modified:
i have a table of
-- Table structure for table `visitor_tracking`
--

DROP TABLE IF EXISTS `visitor_tracking`;
CREATE TABLE IF NOT EXISTS `visitor_tracking` (
  `entry_id` int(11) NOT NULL auto_increment,
  `visitor_id` int(11) default NULL,
  `ip_address` varchar(15) NOT NULL,
  `page_name` text,
  `query_string` text,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`entry_id`),
  KEY `visitor_id` (`visitor_id`,`timestamp`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ;

with data like
INSERT INTO `visitor_tracking` (`entry_id`, `visitor_id`, `ip_address`, `page_name`, `query_string`, `timestamp`) VALUES
(32, 1, '98.28.197.00', '/single_event_page.php', 'id=5', '2014-01-10 19:18:18'),
(33, 1, '98.28.197.00', '/single_event_page.php', 'id=2', '2014-01-10 19:31:49');
sorry for only 2 entries

i need to get the page views for unique hits so i assume i need to group ips and filter by page_name and query_string as the page name is with the query string.

how do i do i return records for a certain date and for the month?
im not understanding how to use distinct and group correctly in my mysqli select string.

thank you for any code or help you may provide.
Johnny
ASKER CERTIFIED SOLUTION
Sharath S
Data Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros