Hello Erich, Thursday, March 4, 2004, 3:23:41 PM, you wrote:
EB> I have a problem with a select returning duplicates, even though there EB> aren't any duplicates in the database. EB> select EB> e.EventID, EB> date_format(e.EventDate, '%c/%d/%y') as EventDate, EB> e.EventTime, EB> v.VenueName, EB> v.VenueID EB> from EB> events e, EB> venues v; EB> +---------+-----------+-----------+-----------------+---------+ EB> | EventID | EventDate | EventTime | VenueName | VenueID | EB> +---------+-----------+-----------+-----------------+---------+ EB> | 2 | 3/06/04 | 09:00:00 | The Bombshelter | 1 | EB> | 3 | 3/12/04 | 09:00:00 | The Bombshelter | 1 | EB> | 2 | 3/06/04 | 09:00:00 | Goodtimes | 2 | EB> | 3 | 3/12/04 | 09:00:00 | Goodtimes | 2 | EB> +---------+-----------+-----------+-----------------+---------+ EB> I tried adding a "distinct" to the above select, which had no effect. I EB> also ran an "explain" on the query: EB> Which tells me nothing. What have I done wrong here? First of all, I would be quite concerned that your EXPLAIN query showed that you were not using a single key/index in your query. But, this is not the place to get into a discussion about that yet - just something to think about. You are getting duplicates because of the SELECT part of your query - you're asking for 5 values and while you have duplicates no-where are ALL of the values duplicated. DISTINCT probably isn't what you need here, instead look at using a GROUP BY on perhaps the VenueName (if that is what you need grouped). -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]