sql - Joins vs. other methods in mySQL -


i'm self-taught, there obvious gaps in knowledge. when needed able data more 1 table, learned how joins. example, if need voucher number, account number, , balance vouchers table , corresponding address table, i'd this:

select v.vouchernbr, v.balanceinit, v.acctid, a.address, a.city vouchers v left join addresses on v.acctid = a.id 

which return voucher records, , addresses happen exist (in case want return voucher records if there's no corresponding address, hence left join.)

i've inherited code appears trying same data (and in case, return correct records) this:

select v.vouchernbr, v.balanceinit, v.acctid, a.address, a.city vouchers v, addresses  v.acctid = a.id 

can explain me implications of doing instead of using join. said, in particular case return same data join does, always?

it join, implicit one. poor coding practice , should replaced inner join.

the problem outdated code is easy accidentally create cross join , code harder maintain (you should not mix implicit , explicit joins inthe same query or might wrong results).


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -