Posted on 2011-10-15
Last Modified: 2012-05-12
Hello experts,
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 ????
FROM StoreInwards
???? - Means Select values from ReceivedQuantityOriginal column
Question by:Manoj Patil
    LVL 7

    Accepted Solution

    You would just need to do:

    CASE WHEN ReceivedQuantity = 0 THEN ReceivedQuantityOriginal ELSE ReceivedQuantity END.
    LVL 19

    Author Closing Comment

    by:Manoj Patil
    Thanks for solution. Just a piece of code solve the Problem.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    Read about achieving the basic levels of HRIS security in the workplace.
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now