Code Comments
Programming Forum and web based access to our favorite programming groups.say i have a statement as such : select Name, ID from Staff where Status=1 However staff table contains duplicate entries of every record. Is there a shortcut such that i only retrieve one of each duplicate record, but all the unique records are retrieved i.e there is more than 1 unique record where Status =1 i.e ID Name Status 01 John 1 01 John 1 03 Tom 1 03 Tom 1 05 Sam 1 05 Sam 1 07 Chris 0 07 Chris 0 i want to retrieve one entry of each unique name ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums
Post Follow-up to this messageI don,t think you can etrive only one, but you can SHOW only one:
1 - Sort them by ID in your query
2 - Declare id1="" before your loop
3-
id2=myresult['id'];
while (id1 != id2){
===yourscript here===
id1=id2
}
should work...
----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.