View Single Post

  #1 (permalink)  
Old 03-15-2007
rics
 
Posts: n/a
Default A performance question in select statement

In response to my last question, Captain Paralytic send a diferente
select statement to me. My own select was like this:


SELECT u.id, u.usuario, g.grupo
FROM usuarios u, grupos g, usuarios_grupos ug
WHERE u.id = ug.usuario_id AND g.id = ug.grupo_id


The select of Captain Paralytic was like this:


SELECT u.id, u.usuario, g.grupo
FROM usuarios_grupos ug
JOIN usuarios u ON ug.usuario_id = u.id
JOIN grupos g ON ug.grupo_id = g.id


They return exactly the same results, so my question now is: Is there
any performance issue that I'm missing, or the two statements are
pretty much the same? Is all about syntax only? Which aproach is
better??? Why???

Reply With Quote