To join or not to join?

2010-08-25 Thread Chris W
I need a single row from 2 different tables. It is rather trivial to create a join that will join these two tables and give me all the information I want in one query. It is also fairly easy to just execute two different queries with out any join and get the data I need. Since the both singl

Re: to join or not to join, that is the query

2007-02-11 Thread Jay Pipes
Miguel Vaz wrote: I have three tables: TABLE Person - id_person, name, id_levelA, id_sizeA, id_levelB, id_sizeB TABLE Levels - id, desc TABLE Sizes - id, desc Hi! You can always join a table twice :) SELECT p.id_person , lA.desc as levelA , sA.desc as sizeA , lB.

to join or not to join, that is the query

2007-02-10 Thread Miguel Vaz
Hi, i am having some difficulty to write a query for the following problem: I have three tables: TABLE Person - id_person, name, id_levelA, id_sizeA, id_levelB, id_sizeB TABLE Levels - id, desc TABLE Sizes - id, desc

To join or not to join

2002-12-19 Thread R. Hannes Niedner
I am looking for an expert opinion on the speed difference between fetching related data from 2 tables with a join and fetching them in to single selects. The scenario is kind of the following: SELECT a , b, c FROM table1 WHERE a='x'; # gets b='y' SELECT b, d , e, f FROM table2 WHERE b='y'; inst

Re: To join, or not to join?

2002-11-25 Thread Michael T. Babcock
On Fri, Nov 22, 2002 at 08:13:46PM -0500, Philip Mak wrote: > SELECT * > FROM boards > LEFT JOIN boardAdmins > ON boardAdmins.userId = #{userId} > AND boardAdmins.boardId = boards.id > LEFT JOIN boardMembers > ON boardMembers.userId = #{userId} > AN

Re: To join, or not to join?

2002-11-22 Thread Philip Mak
On Fri, Nov 22, 2002 at 06:56:53PM -0500, Michael T. Babcock wrote: > On Fri, Nov 22, 2002 at 06:20:14PM -0500, Philip Mak wrote: > > sql,query > > > > Why not just: > SELECT * FROM users, boardAdmins, boardMembers WHERE id = 5; > > You're not really 'joining', since boardAdmins and boardMembers

Re: To join, or not to join?

2002-11-22 Thread Michael T. Babcock
On Fri, Nov 22, 2002 at 06:20:14PM -0500, Philip Mak wrote: > sql,query > Why not just: SELECT * FROM users, boardAdmins, boardMembers WHERE id = 5; You're not really 'joining', since boardAdmins and boardMembers don't have the structure JOINs are made for (it seems). -- Michael T. Babcock CTO

To join, or not to join?

2002-11-22 Thread Philip Mak
sql,query Which way is faster? Way 1: SELECT * FROM users LEFT JOIN boardAdmins ON boardAdmins.userId = users.id LEFT JOIN boardMembers ON boardMembers.userId = users.id WHERE id = 5; Way 2: SELECT * FROM users WHERE id = 5; SELECT * FROM boardAdmins WHERE userId = 5; SELECT * FROM boardMemb