Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Location
    India
    Posts
    40

    Unanswered: if else condition in .SQL file (Urgent)

    Can u give use if and else conditions
    in a .sql file...
    if not what are the other possible ways to use that condition.

    What i am looking for is that
    user enters to date and from date
    based on the no of week between those dates,
    if noofweek > 12 ..then
    display data quaterly wise
    if noofweek> 4 then
    display data month wise

    so help me ..i have to do this in .sql file only...

    thanks in advance
    Suryadevara

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: if else condition in .SQL file (Urgent)

    Use CASE:

    select (case when noofweek > 12 then 'a' else 'b' end) as x
    from ...

  3. #3
    Join Date
    Jun 2002
    Location
    India
    Posts
    40
    Thanks for u r reply i will check it
    Suryadevara

Posting Permissions

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