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 - 2002-06-21 : 08:24:36
|
| Dhananjaya writes "How to retrieve top 3 rows without using top clause and which work in both oracle and sql server" |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-06-21 : 09:43:40
|
quote: Dhananjaya writes "How to retrieve top 3 rows without using top clause and which work in both oracle and sql server"
You haven't provided much detail so I can only offer a general answer. You can implement TOP 3 with the pseudo-sql "select all rows from a rowset where there does not exist three rows that i would sort higher than those rows."setBasedIsTheTruepath<O> |
 |
|
|
macka
Posting Yak Master
162 Posts |
Posted - 2002-06-21 : 09:47:43
|
quote: You can implement TOP 3 with the pseudo-sql "select all rows from a rowset where there does not exist three rows that i would sort higher than those rows."
Ahh - but how do you get the three rows in the exists clause ???macka. |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-06-21 : 10:18:03
|
quote: Ahh - but how do you get the three rows in the exists clause ???
with a HAVING clause. Are you the original poster? If so, you need to post the DDL for your tables so I can see specifically what problem you are facing.setBasedIsTheTruepath<O> |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-06-21 : 11:44:20
|
| I'd add that attempting to code to both SQL Server and Oracle is a bad idea. Neither are pure ANSI standard and there are going to be countless issues like this. IF you do succeed, you're just gonna end up with code that runs poorly on both systems.<O> |
 |
|
|
macka
Posting Yak Master
162 Posts |
Posted - 2002-06-21 : 11:46:42
|
| No, I'm afraid I'm not the original poster.Doh! Was being dense - forgot that you can use COUNT !macka. |
 |
|
|
|
|
|