On Fri, 6 Jun 2003, Jon Earle wrote:
> Hi,
>
> I want to select data from two tables, with the keying information for the
> second table coming from the select results of the first. Can this be
> done in one call, or will I need to resort to two calls - one to get the
> record from the first table, then a second call to get the record from the
> second table based on a key contained in the first results set?
You probably want a join or a sub select.
select * from table1 t1 left join table2 t2 on (t1.id=t2.t1id);
select * from table1 where id in (select id from table2 where compid=3);
Or is it more complex than that?