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  ("Marc Mamin" <M.Mamin@intershop.de>)
Re: exclude part of result  (Tarlika Elisabeth Schmitz <postgresql@numerixtechnology.de>)
Список 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 по дате отправления:

Предыдущее
От: Tarlika Elisabeth Schmitz
Дата:
Сообщение: Re: exclude part of result
Следующее
От: "Marc Mamin"
Дата:
Сообщение: Re: exclude part of result