Results 1 to 3 of 3

Thread: "Top Two" Query - Reqd Results not showing

  1. #1
    Join Date
    Mar 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "Top Two" Query - Reqd Results not showing

    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?

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Thumbs up

    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.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Oracle
    SELECT column FROM table WHERE ROWNUM <= 10
    10? Oracle requires one to use binary for integer values?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •