OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: HOw to get the 10 most recent rows

From: Mel Baluis (msbaluisyahoo.com)
Date: Wed Sep 07 2005 - 23:49:10 CDT


 The doc u read is absolutely correct. u need to use fetching method.

"Jens-Peter C. Hillers" <jphremoteweb.de> wrote:Hello,

ill try to get the last ten rows without fetching the whole table (ODBC !)

the table

CREATE TABLE logtab (
ts timestamp default TIMESTAMP,
username varchar(255) NOT NULL default '',
domain varchar(255) NOT NULL default '',
action varchar(255) NOT NULL default '',
data varchar(255) NOT NULL default ''
)

in postgres & mysql the query is:

SELECT * FROM logtab WHERE domain='$fDomain' ORDER BY ts DESC LIMIT 10

my first idea was:

SELECT *
FROM logtab
WHERE domain='$fDomain'
AND ROWNO < 11
ORDER BY ts

BUT If I've read the doc right maxDB does first fetch the fits ten rows an
then order it.

any help`?

regards
jph
___________________________
Dipl.-Ing. Jens-Peter C. Hillers
Remote Web Services GmbH
Tel: +49 40 25 49 06 22
Fax: +49 40 36 00 67 27
Email: jphremoteweb.de
____________________________

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com