Display 5 top records using SQL

T

Thanasis \(sch\)

Hi to every one,
what i want to achieve is to display the first 5 records (only one
field-lastname ) from a select query.
I tried something like below but it didn't work.


SELECT TOP 5 lastname
FROM Results
ORDER BY hiredate DESC



Thanks in advance
thanasis
 
T

Thanasis \(sch\)

Jon Spivey said:
Hi,
There's nothing wrong with that SQL. What happens, or doesn't happen?

it displays all the records (not only the first 5)


thanasis
 
K

Kevin Spencer

What database are you using?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
T

Thanasis \(sch\)

ms access
Kevin Spencer said:
What database are you using?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Big things are made up of
lots of little things.
 
K

Kevin Spencer

Well, as Jon said, there's nothing wrong with the SQL statement. There must
be something wrong with your code. You were'nt very specific about that.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
P

p c

Yiasou Thanassi.

To febug the porblem, in ASP code do a response write of the SQL
statement at the line before it execcutes. To verify that is the same
one sent to the DB. E.G., if you are using strSQL:

response.write "<br>SQL: " & strSQL


...PC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top