FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » SQL optimization join
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
SQL optimization join [message #168451] Wed, 01 May 2013 08:38 Go to next message
Jack Hard is currently offline  Jack Hard
Messages: 7
Registered: December 2012
Karma: 0
Junior Member
I must to have some SQL queries every day, it generally involves joins I'd like to know which is the most properly way to do a join for example in this tables

A("a",x,y)
B("b",'a',z,w)

where a and b are primary keys,
which is better?

SELECT *
FROM a,b
WHERE a.a=b.a AND a.x<constant

or

SELECT *
FROM (SELECT * FROM a WHERE x < constant) t, b
WHERE t.a=b.a

It means, is better make first the where clause and after make the join or I can do the join and after filter by where
Re: SQL optimization join [message #168534 is a reply to message #168451] Wed, 15 May 2013 14:17 Go to previous message
eclipsewebmaster is currently offline  eclipsewebmaster   
Messages: 46
Registered: November 2009
Location: Ottawa, Ontario, Canada
Karma: 0
Member
First method.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PHP object scope
Next Topic: html entity double escaping
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 07:56:57 GMT 2024

Total time taken to generate the page: 0.02502 seconds