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? Link to comment https://forums.phpfreaks.com/topic/200105-php-mysql-display-results-with-no-duplicates/ 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 Link to comment https://forums.phpfreaks.com/topic/200105-php-mysql-display-results-with-no-duplicates/#findComment-1050257 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. Link to comment https://forums.phpfreaks.com/topic/200105-php-mysql-display-results-with-no-duplicates/#findComment-1050258 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 Link to comment https://forums.phpfreaks.com/topic/200105-php-mysql-display-results-with-no-duplicates/#findComment-1050259 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 Link to comment https://forums.phpfreaks.com/topic/200105-php-mysql-display-results-with-no-duplicates/#findComment-1050261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.