|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hello.
I am trying to limit the number of records to start in a position and show me "n" records. Here is an example query: SELECT TOP 60 * FROM Entries WHERE Id NOT IN ( SELECT TOP 45 Id FROM Entries ORDER BY Id DESC ) AND Static = False AND Authorized = False ORDER BY Id DESC It's not working correctlly. Any ideas? Thanks in advance.
__________________
A false sense of security is worse than insecurity |
|
#2
|
||||
|
||||
|
could you please explain what "not working correctly" means?
crashes the server? returns your bank account balance? issues the "i can't do that" error message? returns the same row fifty times? ![]() |
|
#3
|
|||
|
|||
|
Try putting some extra brackets in as 'IN' is lower precedence than 'AND'. It would at least rule out a semantic error of this type.
|
|
#4
|
||||
|
||||
|
Quote:
IN is an operator, just as = is an operator, and so on operators are use to form conditions ANDs and ORs join conditions |
|
#5
|
|||
|
|||
|
r937
You are right - in this case its not a matter of the wrong precendence though I find it is often useful to explicitly put them in. 'And' and 'or' are boolean operators. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Limiting record count. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|