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

Thread: Picking Order data not for the year 2011

  1. #1
    Join Date
    Apr 2002
    Posts
    41

    Picking Order data not for the year 2011

    Hello

    I have three tables

    customer
    Cust_id,Cust_nm

    Product
    Prod_id,Prod_Nm

    Orders
    Ord_id,Ord_dt,Cust_id,Prod_id

    I want to pick up orders for years other than 2011

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Join the three tables.
    Include a predicate filtering out orders that belong to year 2011.
    What do you have so far?
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  3. #3
    Join Date
    Apr 2002
    Posts
    41
    select c.cust_id,c.cust_id from customer c,order o
    where c.cust_id=o.cust_id and o.ord_dt <'01-JAN-2011'

  4. #4
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Quote Originally Posted by dksuresh View Post
    select c.cust_id,c.cust_id from customer c,order o
    where c.cust_id=o.cust_id and o.ord_dt <'01-JAN-2011'
    Business specs asked to get "orders", I do not see any column coming form "order" table in the selected list of columns.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

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