DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: query problem

  1. #1
    Join Date
    Oct 2000
    Posts
    139
    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?

  2. #2
    Join Date
    Dec 2001
    Location
    Brazil
    Posts
    282

    like this?

    SELECT * FROM TABLE
    WHERE COD = 300008 AND PROD = 6 AND CAT = 5;




    F.




  3. #3
    Join Date
    Oct 2000
    Posts
    139
    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

  4. #4
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    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
  •  


Click Here to Expand Forum to Full Width