Hi Set!

Thank you very much - you've answered most of my question - but created 
another:

> I've assumed route_index is part of the routes table, and that a.id,
> b.id and c.quality are unique in each table.

Your assumptions are correct.  My apologies for not being clearer.

> 
> select r.id,
>         (select a.node from nodes a where r.node_id = a.id) node, 
> route_index,
>         (select b.node from nodes b where r.link_id = b.id) link_node,
>         (select c.quality_label from route_qualities c where r.quality
> = c.QUALITY)
> from routes r
> where exists(select * from nodes a where r.node_id = a.id) and
>        exists(select * from nodes b where r.link_id = b.id) and
>        exists(select * from route_qualities c where r.quality = 
> c.QUALITY)
> order by 2, 3;

Why apparent duplication of the "where" clauses?  Everything from 
"select r.id" to "from routes r" makes sense to me - I don't understand 
the reason for the whole "where exists" section.

If subselects don't offer a performance advantage, and since I find them 
far more confusing than join syntax - I guess I'll forget about them 
until I have a problem they're designed to solve.

--
Daniel

Reply via email to