Jump to content

About JOINs


Darkness Soul

Recommended Posts

Yo, :D

I've been testing querys and come to a conclusion.. [b]a INNER JOIN b[/b] is slow then [b]FROM a,b[/b], at my search query, i've seen the timing.. using inner join, its take 0.8~s, using the other way, its take 0.6~s. ;)

So, if I have this code t1 below, and go to make the code t2 below, how I do to use LEFT JOIN?
[code]-- t1
Select *
From a
Inner Join b
On a.id = b.id_a
Left Join c
On c.id = b.id_c
-- t2
Select *
From a, b, c
Where a.id = b.id_a
And c.id = b.id_c -- This is like inner, how do I a left here?[/code]

Thank you.. :D

D.Soul
Link to comment
https://forums.phpfreaks.com/topic/29108-about-joins/
Share on other sites

I've learned to use joins to "group" tables, but my senior said the t1 style is more simple, so I gonna test and this performance was better then joins, but with stress test, I've look its not really true.. joins are stable, if a join use 3s to execute a query, it'll take 2.8~3.2.. but the other style of code may use 1s~8s.. so I keep with joins, to me they are easy and safe.

But my question was about the use of LEFT JOIN, let me se how be clear.. hmm.. (finding words)

If I have a news with image.. like:
select a.*, b.image from tbnews a left join tbimages b on b.id = a.idimage
..and want to make it without joins.. like:
select a.*, b.image from tbnews a, tbimages b where b.id = a.idimage
..! its work fine with inner join, but don't know how to use with left joins..

better now? :') i'm trying hard

D.Soul
Link to comment
https://forums.phpfreaks.com/topic/29108-about-joins/#findComment-134779
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.