You are here: Re: selecting only a certain number of bits of data « PHP Programming Language « IT news, forums, messages
Re: selecting only a certain number of bits of data

Posted by Toby A Inkster on 04/16/07 10:20

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;

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация