#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    853
    Rep Power
    12

    select row if exists else select all null rows


    This is what I want to do using a single query

    Table_A

    product_code Attribute Value
    null price 100
    null quantity 50
    null weight 10
    A01 price 35
    A01 quantity 25
    A02 quantity 200
    A02 quantity 10

    When I pass the product_code as 'A01', the output should be
    A01 price 35
    A01 quantity 25

    But when I pass the product_code as 'A98' (which doesnt exists), all null product_code should be shown
    null price 100
    null quantity 50
    null weight 10


    How can this be achieved?
    Contact info:
    Primary email: advanced.programmer@gmail.com
    MSN/email: superprg@hotmail.com
    AIM: superprg
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    863
    Rep Power
    388

    Cool


    Originally Posted by superprogrammer
    This is what I want to do using a single query

    . . . E t c . . .

    How can this be achieved?
    You palm yourself off as "superprogrammer", let us see what you got and post what you have coded.
    Or do you expect us to do your homework?
  4. #3
  5. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,867
    Rep Power
    1960
    Isn't that the definition of a super programmer? Letting some others do your work!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    853
    Rep Power
    12
    Thanks for the response
    I did wrote a query which did not work. I will post it here and explain the issue in next post
    Contact info:
    Primary email: advanced.programmer@gmail.com
    MSN/email: superprg@hotmail.com
    AIM: superprg

IMN logo majestic logo threadwatch logo seochat tools logo