PDA

View Full Version : "Top Two" Query - Reqd Results not showing



rka81
09-08-2006, 01:44 PM
Just a quick one (hopefully!)

I have created the table etc in my database that are required and am just working on the queries. I need to create a query that will display the top two entries of one of my tables....as in from the table of Goalscorers (about 10 entries) i want only the top two with the most "Goals" to be shown.

I have tried a few expressions etc but am not getting the required results to show....

anyone got any ideas?

codeexploiter
09-20-2006, 01:50 PM
Microsoft SQL Server
SELECT TOP 2 [columns] FROM table

PostgreSQL and MySQL
SELECT [column] FROM table LIMIT 2

Oracle
SELECT column FROM table WHERE ROWNUM <= 10

You haven't mentioned which is your database but i hope this will solve your problem.

Twey
09-20-2006, 05:35 PM
Oracle
SELECT column FROM table WHERE ROWNUM <= 1010? Oracle requires one to use binary for integer values?