Frank Morton writes:

> These two queries get me what I want from each table:
>
> select unique id from table1 where lastname='morton';
> select unique id from table2 where ((type = "pie") and (content = 'apple));
>
> What is the best way to combine these into one query?

select table1.id from table1, table2 where table1.id = table2.id and
lastname = 'morton' and type='pie' and content = 'apple';

Or in 7.1, optionally:

select id from table1 natural join table2 where lastname = 'morton' and
type ='pie' and content = 'apple';

-- 
Peter Eisentraut      [EMAIL PROTECTED]       http://yi.org/peter-e/

Reply via email to