Results 1 to 3 of 3

Thread: selecting data

  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: selecting data

    Hi

    Please forgive me if you think I should know this.....but I am trying to:

    select

    Column1+Column2 as AA where Column1+Column2>10,
    Column5+Column6 as BB where Coumn5+Column6<90

    from SCHEMA.TABLE_NAME

    But I don't think my syntax is correct.

    Would appreciate some guidance. Thanks.

    Sheraz Ahmad

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by shajju
    But I don't think my syntax is correct.
    And your syntax is?
    Post the full SQL statement and the definition (DDL) of the table.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    SELECT CASE WHEN Column1+Column2 > 10
                THEN Column1+Column2 
                ELSE NULL END              as AA
         , CASE WHEN Column5+Column6 < 90
                THEN Column5+Column6 
                ELSE NULL END              as BB
      FROM schema.table_name
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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