IF... THEN in SELECT QUERY
Posted on 2011-10-15
I wants the records in following scenario.
I have 2 different columns in my table Store_Inwards ReceivedQuantiry and ReceivedQuantityOriginal
I am inserting value in ReceivedQuantiry while adding records but for some conditions, I need to update the values of ReceivedQuantiry to zero. So before updating ReceivedQuantiry column I am copying the values to ReceivedQuantityOriginal.
Now I am displaying the values from ReceivedQuantity but I don't want to display values which are zero instead of this i want to get the value from ReceivedQuantityOriginal column for same record.
I want query like following
SELECT MaterialName, CASE When ReceivedQuantity=0 THEN ????
???? - Means Select values from ReceivedQuantityOriginal column