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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-10-03 : 10:00:03
|
| Ranit writes "Hi All,This is regarding selecting a range of reords in SELECT statement.The problem is that we are following Logical Delete that sets one of the flag column for the logically deleted record to zero. These records won't be picked in the SELECT statement using the WHERE clause.Suppose we have 100 records, out of which 20 have been marked as logically deleted. Now, for the purpose of pagenation on the frontend, we need to display the record no. 21 to 30 (ie. page 3, if records per page are 10) out of the remaining 80 records. What I have been able to do is get all the 80 records, then skip the first 20 records, display the 21 to 30 records and quit.Question 1:Can I directly pick the record no. 21 to 30 without considering the logically deleted records present in the same table and avoid bringing all the records to the result set.I don't want to use stored procedures.Question 2:How efficient or inefficient it is to use SELECT COUNT statement to get the total records returned by the query.Versions:MS SQL Server 7.0Win NT 4.0 with SP 6Using JSP/Java with SQL Server.ThanksRanit" |
|
|
|
|
|