Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    20

    Unanswered: I have another question please

    hello again guys i have another question if anyone can help me on this

    iam trying to find query

    to list of all product prices along with how many products of that
    price ar in each of the two categories

    I have attached an image

    select Products.ProductID,Products.Cat_ID from Products where Cat_ID = 1 or 2
    Attached Thumbnails Attached Thumbnails Image.bmp  

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    come on, anthitis, this is pretty basic stuff
    Code:
    SELECT Cat_ID 
         , Sales_Price
         , COUNT(*) AS products
      FROM Products 
     WHERE Cat_ID IN ( 1,2 )
    GROUP
        BY Cat_ID 
         , Sales_Price
    are you sure this isn't a homework assignment?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2010
    Posts
    20

    Thanks for your response

    Thanks man , I am 44 years old and memory starts to leak
    so some times cannot think of anything, Anyway this is
    what i did from first place , but i thought o was rong
    Thats why i asked for help. It's not an assigment or school
    homework i have build that database my self for someone
    and try to answer some queries to make the program
    work.
    Thanks are you sure it's the right answer , Coz
    I thought that the right answer was to list all product
    prices belongs to first category, and all products belongs
    to second, like 10 products 2 category
    and 3 products to 1 category

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •