SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 before one record
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ozandalkiran
Starting Member

Turkey
10 Posts

Posted - 11/28/2012 :  11:59:19  Show Profile  Reply with Quote
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

Edited by - ozandalkiran on 11/28/2012 12:22:50

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 11/28/2012 :  12:10:25  Show Profile  Reply with Quote
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

Turkey
10 Posts

Posted - 11/28/2012 :  12:21:44  Show Profile  Reply with Quote
i want
the last record without the need to level 0
Go to Top of Page

ozandalkiran
Starting Member

Turkey
10 Posts

Posted - 11/28/2012 :  12:22:17  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 11/28/2012 :  12:25:21  Show Profile  Reply with Quote
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

Turkey
10 Posts

Posted - 11/29/2012 :  02:04:45  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 11/29/2012 :  07:43:57  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000