AdrianSmithUK
asked on
MySql: Date range problem
The query below returns some website data between two dates.
It worked fine until I added the line:
AND `_website` LIKE '%" . $site . "%'
Now it only shows results for the lower date and not the date range.
How should I rewrite it?
It worked fine until I added the line:
AND `_website` LIKE '%" . $site . "%'
Now it only shows results for the lower date and not the date range.
How should I rewrite it?
SELECT
min( _tStamp ) _tStamp,
`_website` ,
`_sid` ,
`_tag` ,
`_ip` ,
`_host` ,
`_town` ,
`_region` ,
`_country` ,
count( DISTINCT _id ) _totalPageViews ,
max(_serverLoad) _maxServerLoad ,
min(_serverLoad) _minServerLoad ,
max(_pageLoadTime) _maxPageLoadTime ,
min(_pageLoadTime) _minPageLoadTime ,
sum( `_pageVisitTime` ) _totalVisitTime,
sum(`_pageScrollSeconds`) _totalScrolls,
sum( _pageClicks )_totalPageClicks ,
`_screenWidth` ,
`_screenHeight`,
`_userAgent` ,
`_referrer`
FROM visitor_logs_version_c
WHERE _host IS NOT NULL
AND `_website` LIKE '%" . $site . "%'
AND (`_tStamp` BETWEEN '" . $fromDate . " 00:00:00' AND '" . $fromDate . " 23:59:59')
GROUP BY _sid
ORDER BY _tStamp DESC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks :@)