Hi
I have this table
COD CAT PROD
---------- ---------- ----------
300004 5 6
300004 5 7
300007 5 7
300007 5 6
300007 5 12
300008 5 6
300008 5 7
300008 5 8
I need to write a qeury which returns me cod 30008 only, that is prod is 6 and 8 and cat is 5, I have tried some queries but all returns more results than I need. Anyone know how can I accomplish this?
like this?
SELECT * FROM TABLE
WHERE COD = 300008 AND PROD = 6 AND CAT = 5;
F.
no... because I dont know the cod, I only know prod and cat!
I found solution anywayz
select cod from product where cat=5 and prod=8
intersect
select cod from product where cat=5 and prod=6
select distinct cod from product where cat=5 and prod=8 ;
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks