i have this record in my table
name income
john 4500
peter 4500
jake 3000
jane 3000
paul 2000
gorge 1000
if i use the SELECT TOP 2 it will return me john and peter only how can i query to return me the 2 biggest income. that will return john peter jake and jane
thx.. just a newbie sory..i have this record in my table
name income
john 4500
peter 4500
jake 3000
jane 3000
paul 2000
gorge 1000
if i use the SELECT TOP 2 it will return me john and peter only how can i query to return me the 2 biggest income. that will return john peter jake and jane
thx.. just a newbie sory..
use ORDER BY. As in
SELECT TOP 2 *
FROM MyTable
ORDER BY income DESC
Regards,
hmscott|||hi
try this
SELECT
namefield
FROM
yourtable
WHERE
incomefield
IN
(SELECT DISTINCT TOP 2 incomefield FROM yourtable ORDER BY incomefield DESC)
No comments:
Post a Comment