Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2005
    Posts
    92

    Unanswered: Capture Null or Zero when no address

    Hi everyone,

    I am new to oracle SQL. can anyone please help me how can I achieve this using sql. When there is no address for a customer then the output should be either zero or null however if there is address available for any customer it should be selected for output/

    Table: Customer
    CustID DateCreated
    1 2015
    2 2014
    3 2013
    4 2014
    5 2015

    Table: Party
    PartyID CustID
    101 1
    102 2
    103 3
    104 4
    105 5

    Table Address:
    AddrID PartyID Addr
    10 101 King St, Toronto
    20 102 Queen St, NY
    30 103
    40 104
    50 105

    Desired Output:
    CustID PartyID Address
    1 101 King St, Toronto
    2 102 Queen St, NY
    3 103 0
    4 104 0
    5 105 0

    Thanks
    Pavan

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    May 2014
    Location
    World Wide On The Web
    Posts
    16
    Quote Originally Posted by pavan_test View Post
    either zero or null
    What do you mean by either? They are completely different.
    Regards,
    Lalit

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    ... because, you'd get NULL anyway (i.e. you don't have to do anything at all).

  5. #5
    Join Date
    Oct 2005
    Posts
    92
    yes, looking for null when there is no address

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5

Posting Permissions

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