Professional Web Applications Themes

Newbie Question(need help) - Microsoft SQL / MS SQL Server

StudentID Gender Age 1 Male 12 2 Male 10 3 Femaile 16 4 Male 09 5 Male 14 6 Female 12 7 Female 13 8 Male 14 SQL: how to return 3 highest age with its corresponding Gender and StudentID?. -- Sent by msg_2222 from yahoo subpart from com This is a spam protected message. Please answer with reference header. Posted via http://www.usenet-replayer.com/cgi/content/new...

  1. #1

    Default Newbie Question(need help)

    StudentID Gender Age

    1 Male 12
    2 Male 10
    3 Femaile 16
    4 Male 09
    5 Male 14
    6 Female 12
    7 Female 13
    8 Male 14

    SQL:
    how to return 3 highest age
    with its corresponding Gender and
    StudentID?.







    --
    Sent by msg_2222 from yahoo subpart from com
    This is a spam protected message. Please answer with reference header.
    Posted via http://www.usenet-replayer.com/cgi/content/new
    msg_2222@yahoo.com Guest

  2. #2

    Default Re: Newbie Question(need help)

    You can try:
    SELECT TOP 3 StudentID, Gender, Age FROM yourTable ORDER BY age DESC
    --
    HTH,
    SriSamp
    Please reply to the whole group only!
    http://www32.brinkster.com/srisamp

    "com" <ip-mobilphone.net> wrote in
    message news:rev.o1.com... 


    SriSamp Guest

  3. #3

    Default Newbie Question(need help)

    Hi,
     
    [...]
     

    select top 3 Gender,StudentID
    from table
    order by age desc

    with "top 3" keyword you only get the 3 topmost records.
    With "order by age desc" the highest ages come first.

    - Oliver


    Oliver Guest

Similar Threads

  1. Newbie Question: Biz Card Template Question
    By Thomas_Porter@adobeforums.com in forum Adobe Indesign Windows
    Replies: 4
    Last Post: May 30th, 08:08 AM
  2. A newbie with a newbie question
    By dusty_davis@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 5
    Last Post: October 14th, 07:54 AM
  3. a newbie question(network question)
    By hardemr in forum MySQL
    Replies: 2
    Last Post: February 2nd, 06:08 PM
  4. Replies: 5
    Last Post: December 3rd, 10:44 AM
  5. Pen Tool Use Question. (Embarrassingly Newbie Question)
    By Bozo Schmozo in forum Macromedia Flash
    Replies: 0
    Last Post: November 12th, 10:00 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139