lxndr Posted April 22, 2007 Share Posted April 22, 2007 I have a table with a column called 'forename' and what I want to be able to do is put all the different values for forenames into a PHP array but only once each, i.e. if there are 20 instances of the forename "John" I only want one of them, in other words I want to capture all the different values. I could do this I guess by using an SQL GROUP query but was wondering if there was a better/more efficient way ? .. Link to comment https://forums.phpfreaks.com/topic/48119-solved-getting-all-the-different-values-for-a-column/ Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 $query = "SELECT DISTINCT forename from Table "; Link to comment https://forums.phpfreaks.com/topic/48119-solved-getting-all-the-different-values-for-a-column/#findComment-235168 Share on other sites More sharing options...
lxndr Posted April 22, 2007 Author Share Posted April 22, 2007 $query = "SELECT DISTINCT forename from Table "; That's great. Thanks. .. Link to comment https://forums.phpfreaks.com/topic/48119-solved-getting-all-the-different-values-for-a-column/#findComment-235178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.