Hi all, you are always so helpful, what's wrong with this; $sql2="SELECT base.ID as ID, base.id_surname, surname.id_surname, surname, sortname, name, id_name, sex FROM base RIGHT JOIN surname ON base.id_surname = surname.id_surname WHERE ID like $ID AND surname like '".$lit."%' ORDER BY surname"; it works fine, but it doesn't sort alphabetically... Thanks for any help, Wolf -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.5/707 - Release Date: 3/1/2007 2:43 PM