Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: exclude par...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3551 of 3799
Post > Topic >>

Re: exclude part of result

by hari.fuchs@[EMAIL PROTECTED] (Harald Fuchs) Jun 27, 2008 at 11:33 AM

In article <20080627075136.12add021@[EMAIL PROTECTED]
>,
Tarlika Elisabeth Schmitz <postgresql@[EMAIL PROTECTED]
> 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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 3 Posts in Topic:
Re: exclude part of result
postgresql@[EMAIL PROTECT  2008-06-27 07:51:36 
Re: exclude part of result
hari.fuchs@[EMAIL PROTECT  2008-06-27 11:33:07 
Re: exclude part of result
M.Mamin@[EMAIL PROTECTED]  2008-06-27 12:50:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:39:39 CST 2008.