Posted by roondog on 04/16/07 11:18
"Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
news:i7vbf4-4kp.ln1@ophelia.g5n.co.uk...
> roondog wrote:
>
> > I would now like to only show a certain number of the news articles.
> > Say the latest five.
>
> Certain databases allow you to use a "LIMIT" clause to limit the number of
> results returned by a SELECT query. Because this is not part of the
> official SQL standard, the exact syntax varies between databases. Here are
> some examples:
>
> MySQL:
> SELECT * FROM articles ORDER BY created_date DESC LIMIT 5;
>
> PostgreSQL:
> SELECT * FROM articles ORDER BY created_date DESC LIMIT 5;
>
> Microsoft SQL Server:
> SELECT TOP 5 * FROM articles ORDER BY created_date DESC;
>
Thanks for that I knew there was something simple I was missing.
[Back to original message]
|