#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Need Urgent Help


    I have table like following rec_ing_inf

    R_ID ING_ID QUANTITY
    1 1 2cups
    1 2 25gms
    2 3 25gms
    2 4 25gms
    2 5 25gms
    3 2 150gms
    3 4 3
    3 8 2sliced
    1 9 2spoons
    1 10 1tsp

    now i want to select r_id based on ing_id values.
    for ex:
    select r_id from rec_ing_inf where ing_id=2 and ing_id=9
    it is giving no data found
    select r_id from rec_ing_inf where ing_id=2 or ing_id=9
    it is giving r_id values like 1,3
    but my expected output is r_id value =1

    please let me know the ans....... i need very urgent solution for this thanku in advance
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    857
    Rep Power
    388

    Cool


    Originally Posted by ram.prince17
    ...
    please let me know the ans....... i need very urgent solution for this ...
    Please explain why it is urgent for us to solve this problem for you?

    This is SQL 101, you should have done your homework!
    Now you need to go back and check your class notes.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by LKBrwn_DBA
    Please explain why it is urgent for us to solve this problem for you?

    This is SQL 101, you should have done your homework!
    Now you need to go back and check your class notes.
    Actually I'm a java developer, has less knowledge in oracle... could you give me solution. i tried my best
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    857
    Rep Power
    388

    Cool


    Originally Posted by ram.prince17
    Actually I'm a java developer, has less knowledge in oracle... could you give me solution. i tried my best
    Here:
    Code:
    SELECT r_id
      FROM rec_ing_inf
     WHERE ing_id IN ( 2, 9)
     GROUP BY r_id
     HAVING COUNT(*) = 2
    /

IMN logo majestic logo threadwatch logo seochat tools logo