Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 before one record

Author  Topic 

ozandalkiran
Starting Member

13 Posts

Posted - 2012-11-28 : 11:59:19
hi
i want to write that query.
i have oil lots of oil tank.
some times our system can not be define underde the 13 cm how many liter do we have. so i need when product level equal to 0's one record before. sory my english is not good.

where ProcessTime >='20121101' and ProcessTime<'20121201'
and ProductLevel ( the last record without the need to level 0)


thanks

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-11-28 : 12:10:25
I'm not sure I understand how to express the predicate from what you wrote. Can you provide DDL, DML and expected output? Here are some links that can help with that:

http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

ozandalkiran
Starting Member

13 Posts

Posted - 2012-11-28 : 12:21:44
i want
the last record without the need to level 0
Go to Top of Page

ozandalkiran
Starting Member

13 Posts

Posted - 2012-11-28 : 12:22:17
quote:
Originally posted by ozandalkiran

hi
i want to write that query.
i have oil lots of oil tank.
some times our system can not be define underde the 13 cm how many liter do we have. so i need when product level equal to 0's one record before. sory my english is not good.

where ProcessTime >='20121101' and ProcessTime<'20121201'
and ProductLevel ( the last record without the need to level 0)


thanks

Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-11-28 : 12:25:21
How do determine the order of the rows to determine the "last" row?

It's very hard for us to help withoyt knowing your data. Please, follow the links I provided and post the proper information for us to be able to help you better.
Go to Top of Page

ozandalkiran
Starting Member

13 Posts

Posted - 2012-11-29 : 02:04:45
quote:
Originally posted by Lamprey

How do determine the order of the rows to determine the "last" row?

It's very hard for us to help withoyt knowing your data. Please, follow the links I provided and post the proper information for us to be able to help you better.



if productlevel equal to 0, maybe we can get before the 0 record.
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-11-29 : 07:43:57
Write your question clearly and with as much detail as possible in Turkish. Then translate it to English using http://translate.google.com and post the translated version. With what you have posted so far, it has not been possible to understand the problem.

Also, look at the two links Lamprey posted (translate them to Turkish using http://translate.google.com if you have to). Those will help write your question in a form others can understand.

http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -