langemarkdesign Posted April 29, 2010 Share Posted April 29, 2010 I have a table that lists all the referring websites to my site along with the users IP. What I need to do is run a query to list all the different referrers, but not list the same one more than once. It sounds easy enough, but I can't figure it out. Any tips? Quote Link to comment Share on other sites More sharing options...
litebearer Posted April 29, 2010 Share Posted April 29, 2010 DISTINCT and UNIQUE may be words looking into Quote Link to comment Share on other sites More sharing options...
langemarkdesign Posted April 29, 2010 Author Share Posted April 29, 2010 Just thought I could list them in an array and remove the duplicates from the array, but I am looking for an easier, faster solution. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 29, 2010 Share Posted April 29, 2010 Use MySQL's "GROUP BY" clause: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html Or, depending on what you are wanting, "DISTINCT". SELECT DISTINCT(referrer) FROM tablename Quote Link to comment Share on other sites More sharing options...
langemarkdesign Posted April 29, 2010 Author Share Posted April 29, 2010 DISTINCT and UNIQUE may be words looking into SELECT DISTINCT is exactly what I was looking for. Thank you 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.