sql - Transposing number from one column into another one where = 0 -


I'm my question is,

I work on which I have a query and I There are some values ​​that have 0 which is 0. I want to be able to take a price from last month which is not zero and it is placed in place of zero. Example See item below, sold stock, month, year, level HAVING (item = @ Aitem) year, by month

  select items, stock, sell, level, month, year From   

Enter image details here

Therefore, I want to take the number 2455 and invest it in the stock where it says 0, take the balance of the previous months to take stock levels of the current months. Is this also possible?

You used this question to create the last non zero level per item (for zero level items) can find:

  SELECT find.item, find.month, find.year, Join Ajingdata results result.level (choose original. Atom, original. message origin. year maximum (artist (artist last. as Varchar) + + - (+ last. month as varchar) + '1' is Ajingdeta linked to the original as the time of day)) previous _dutt AgingData original.item last = Previous.it em and ((original.year & gt origin;. results). Result = find.item and cast (cast (result. year as Varchar) + '-' + cast (resulting as varchar) + '1' as datetime) = find.previous_date   

this will work, even if the last non-zero level several months ago.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -