Re: The Row Holding the Maximum of a Certain Column

Frank Schönheit - Sun Microsystems Germa ny <[email protected]>
Newsgroups gmane.comp.openoffice.dba.user
Message-ID <[email protected]>
Hi Gert,

> The OOo base manual somewhere says that the format of the SQL statement is
> dependent on the format of the underlying database.

Which is true, since every database extends the SQL standard with its
own functionality, and OOo cannot know all of them. To a certain extent,
the UI tries to hide this from you, but when it comes to directly
editing an SQL query, you need to know what the underlying database does
expect.

> To get the maximum value for a column, MySQL allows a select statement like:
> 
> SELECT `Date` FROM `tablename`
> WHERE `Date` = (SELECT MAX(date) FROM `tablename`);
> 
> However, when I cut and paste this into a Base SQL stmt I get a parse error
> " Expecting 'Between' or 'In' or 'SQL_Token_Like' "

Try quoting the date column name in MAX(date), i.e. MAX(`Date`). Then it
works for me.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer         [email protected] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Database                   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.