The Little Guy Posted September 16, 2008 Share Posted September 16, 2008 Any Idea how you would find a bounce rate? I have a multiple number of fields: ip, currentPage, referrer, date (and more unrelated). Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 16, 2008 Author Share Posted September 16, 2008 Current code Returns 0... it shouldn't: SELECT COUNT(DISTINCT ip) < 2 as bounceCount FROM stats WHERE owner_id = '%s' AND project_id = '%s' AND DATE_SUB(CURDATE(),INTERVAL 20 DAY) GROUP BY project_id Quote Link to comment Share on other sites More sharing options...
corbin Posted September 16, 2008 Share Posted September 16, 2008 Errr, I'm pretty sure COUNT(DISTINCT ip) < 2 will be evaluated, so it will be bool, or in other words 0 or 1. I'm guessing you have more than 2 records, hence 0. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 16, 2008 Author Share Posted September 16, 2008 I have no Idea how I would make this query... I "think" I need to find all the ip address that a have less than two page accesses... how could I do that? Quote Link to comment Share on other sites More sharing options...
fenway Posted September 16, 2008 Share Posted September 16, 2008 Bounce rate? What's that? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 16, 2008 Author Share Posted September 16, 2008 Bounce rate? What's that? A user comes to a page on your site, then leaves right away, not visiting any other pages. Quote Link to comment Share on other sites More sharing options...
corbin Posted September 16, 2008 Share Posted September 16, 2008 Errr, not sure about your table schema (you gave it on the first post, but it looks either incomplete or named squirrely). Let's say you have: ip_address | url just for simplicity Anyway, this is probably far from the most efficient way to do this, but I can't think of anyway else to do it. (I would consider my self good with most SQL, but when it comes to counting and constraints, I'm horrible. Absolutely terrible.) Something like: SELECT ip_address, COUNT(url) AS count FROM table HAVING count >= 2; One problem I see right away with that is that the results will be limited after they are fetched, so you will essentially be getting all of the rows (MySQL side, not in PHP), then looking through them. Guessing someone will have a better way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.