Sunday, September 16, 2018

How do I do multiple case when condition using SQL Server 2008?

How do I do multiple case when condition using SQL Server 2008?
What I'm trying to do is use more than one CASE WHEN condition for the same column.
Here is my code for the query:
   SELECT   Url='',
            p.ArtNo,
            p.[Description],
            p.Specification,
            CASE 
            WHEN 1 = 1 or 1 = 1 
               THEN 1 
               ELSE 0 
            END as Qty,
            p.NetPrice,
            [Status] = 0
      FROM  Product p (NOLOCK)
However, what I want to do is use more then one WHEN for the same column "qty".
As in the following code:
IF
// CODE
ELSE IF
// CODE
ELSE IF
// CODE
ELSE
// CODE

No comments:

Post a Comment

SQL Important Queries

  How to delete rows with no where clause The following example deletes  all rows  from the  Person.Person  the table in the AdventureWork...