2017-06-15 106 views
-3

例如我有2個查詢:這些查詢是否相同?

1)

SELECT * FROM unit 
INNER JOIN entity 
WHERE unit.length = entity.length 

2)

SELECT * FROM unit 
INNER JOIN entity ON entity.length = unit.length 

是這些查詢等效?

+0

是的,如果第一次工作。從我看來,首先應該是'SELECT * FROM unit,entity WHERE unit.length = entity.length',但這是可怕的代碼風格。 – degr

+0

Dupe train:https://stackoverflow.com/questions/44917/explicit-vs-implicit-sql-joins,https://stackoverflow.com/questions/1018822/inner-join-on-vs-where-clause, https://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause?rq=1 .. –

+0

感謝大家,是的,它是一個重複的,下次我會更仔細地看 –

回答

0

是的,這兩個查詢都會產生相同的結果。