Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2010
    Posts
    1

    Unanswered: Need help with sql

    Hi guys

    i need little help in below mentioned sql.... need to find out any of col1,col2,col3 is null and in last if col3 is null then in that case col2 should have A1,A2,A3 values only not other than this.....

    select col1, col2, col3, id from tab1, tab2 where tab1.id=tab2.id
    and ((col1 is not null or (col2 is null or col3 is null))
    or (col2 is not null or (col1is null or col3 is null))
    or (col3 is not null or (col1 is null or col2 is null))
    and (col3 is null and col2 in ('A1','A2','A3')))

    If you need more info please let me know

    thanks & regards

  2. #2
    Join Date
    Oct 2010
    Location
    Chennai
    Posts
    1
    you can add select case statement and assign the values (A1,A2 & A3) based on your condition.

    Please let me know if you need the exact query.

    Thanks

  3. #3
    Join Date
    Apr 2008
    Location
    Along the shores of Lake Michigan
    Posts
    242
    Do you have sample input data and expected results?
    -- You can't be late until you show up.

Posting Permissions

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