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
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.
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
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
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
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
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
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