RE: Inner Join or 2nd Query...?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I may, 

It depends, are the fields you're joining on indexed? How many keys are
being joined and how many joins are you using. What database are you using?
Which version?

I prefer to use joins myself because it gets all the data in one place.
However if you find that you are using a lot of where statements with your
join you may wish to consider a sub select instead. 

A good thing to do would be to try each case and see which works faster in
your situation..


Carl Furst
Vote.com
P.O. Box 7
Georgetown, Ct 06829
203-544-8252
carl@xxxxxxxx

-----Original Message-----
From: Mark Sargent [mailto:powderkeg@xxxxxxxxxxxxxxxx] 
Sent: Wednesday, May 11, 2005 10:31 AM
To: php-general@xxxxxxxxxxxxx
Subject: Re:  Inner Join or 2nd Query...?

Mark Rees wrote:

>Hi All,
>
>with wanting to show both product types(Switch, Router etc) and 
>Makers(Cisco, Avaya, etc) on the one page in select boxes, I was 
>wondering, do you use 2 seperate queries to the database or do you inner
>
>join to get all in 1..? I have set up different tables with related id's
>
>etc. So, to get Products.product_name and Products.product_id along with
>
>what the below query pulls, what wold be best..? I believe if I do a 2nd
>
>query, than some variables need to be identified with the particular 
>query, yes..? Cheers.
>----------------------------------------
>What is your question in one sentence?
>
>Is it "how do I do an inner join"?
>  
>
I guess I was looking for people's opinions, not a specific answer, I 
think...

>Is it "are two separate queries on two tables faster than one query on
>both tables"?
>  
>
Well, again, no not really. I guess I was curious how others do things.

>Or something else entirely?
>  
>
Could be. Sorry, perhaps I'm thinking too general with this, yes..? Cheers.

Mark Sargent.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux