hello guys, i've always made my own programing but i've now hit a bit of a problem with mySQL and php. i have two tables: citys: id_city, city_name events: id_event, id_city, event how can i select only the cities that have events registered, but i want to have them displayed only once in a list. Mike
I'm not sure if joins or subqueries are more efficient on MySQL, so you could also try: SELECT `city_name` FROM `citys` WHERE `id_city` IN (SELECT DISTINCT `id_city` FROM `events`);
I've usually found that sub queries are less efficient than joins, depending on the tables and the number of joins. for something like this, i'd say a join is better.