ukscotth Posted August 22, 2011 Share Posted August 22, 2011 Hi, I have a database table which is full of books e.g book_title, book_author, book_date etc. Im trying to work out a way to list all the authors without duplicating them, if that makes sense. If I do a simple query and then display the book_author in a loop it will show multiple entries for each author. I just want it to display each author once. Hope that makes sense lol sorry Im a newbie. Anyone know how I can do it ? Thanks in advance, Scott. Link to comment https://forums.phpfreaks.com/topic/245445-ignoring-duplicates/ Share on other sites More sharing options...
WebStyles Posted August 22, 2011 Share Posted August 22, 2011 select distinct `author` from `table_name` order by `author` Link to comment https://forums.phpfreaks.com/topic/245445-ignoring-duplicates/#findComment-1260645 Share on other sites More sharing options...
ukscotth Posted August 22, 2011 Author Share Posted August 22, 2011 Thanks alot webstyles, il give it a try Link to comment https://forums.phpfreaks.com/topic/245445-ignoring-duplicates/#findComment-1260646 Share on other sites More sharing options...
ukscotth Posted August 22, 2011 Author Share Posted August 22, 2011 works perfect. Thanks again. Link to comment https://forums.phpfreaks.com/topic/245445-ignoring-duplicates/#findComment-1260679 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.