Re: exclude part of result
От | Harald Fuchs |
---|---|
Тема | Re: exclude part of result |
Дата | |
Msg-id | pubq1nfcj0.fsf@srv.protecting.net обсуждение исходный текст |
Ответ на | Re: exclude part of result (Tarlika Elisabeth Schmitz <postgresql@numerixtechnology.de>) |
Ответы |
Re: exclude part of result
Re: exclude part of result |
Список | pgsql-sql |
In article <20080627075136.12add021@dick.coachhouse>, Tarlika Elisabeth Schmitz <postgresql@numerixtechnology.de> writes: > PRODUCT table : > A B C > 100 200 300 > 100 200 301 > 100 205 300 > 100 205 301 > NAVIGATION table > A B C #ITEMS > 100 200 300 5 > 100 200 301 6 > My query needs to return > 100 205 300 #items > 100 205 301 #items > so I can insert them in NAVIGATION. NAVIGATION must not contain any > duplicate combinations of [a,b,c]. Just use another LEFT JOIN to filter out the corresponding product lines: SELECT DISTINCT a, b, c, now(), count(item_pk) FROM product LEFT JOIN navigation USING (a, b, c) LEFT JOIN item ON item.product_fk = product_pk WHERE navigation.a IS NULL GROUP BY a, b, c
В списке pgsql-sql по дате отправления: