| От | David M. Kaplan |
|---|---|
| Тема | join queries |
| Дата | |
| Msg-id | 3AD71B12.677FB100@genes.bio.puc.cl обсуждение исходный текст |
| Ответы |
Re: join queries
|
| Список | pgsql-general |
Hi, I have a query which seems like it should easy, but isnt. I have two tables, a and b that look like this: a) id | c1 --+-- 1 | a 2 | b 3 | c b) id | c2 --+-- 2 | b and I would like to do a query which returns id | c1 | c2 --+--+-- 1 | a | 2 | b | b 3 | c | The simplest thing I could find was SELECT a.*, (SELECT b.c2 WHERE a.id=b.id) AS c2; This works, but is extremely slow for more complex examples. Is there a better way to do this in postgresql?? I think MS Access has inner and outer joins to solve this problem. Is there a postgresql equivalent? Thanks for the help. David Kaplan
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера