Re: combining
| От | Peter Eisentraut |
|---|---|
| Тема | Re: combining |
| Дата | |
| Msg-id | Pine.LNX.4.30.0102121959220.1100-100000@peter.localdomain обсуждение исходный текст |
| Ответ на | combining ("Frank Morton" <fmorton@base2inc.com>) |
| Список | pgsql-sql |
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 peter_e@gmx.net http://yi.org/peter-e/
В списке pgsql-sql по дате отправления: