OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

SQL LIMIT on MySQL/ODBC connection

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
avantman42
Super User
Super User


Joined: 28 Jul 2003
Posts: 751
Location: Staffordshire, UK

PostPosted: Thu Feb 12, 2004 9:05 am    Post subject: SQL LIMIT on MySQL/ODBC connection Reply with quote

I'm trying to replace an MS Works database at work with MySQL running on Debian, with OOo for the front-end. The following SQL returns errors:

Code:

SELECT `Firm Name`, `Date Received`, `File Name`, `Our Ref`, `Their Ref`, `Our Ref` AS OurRef
FROM `clc_db`.`FileTracker` `FileTracker`
ORDER BY RIGHT (OurRef, 5) DESC LIMIT 1


The query is created by a macro. When I first open it to edit it, the error message is:

Quote:

parse error, expecting `$'


However, when I try to run the query, I get the following error:

Quote:

parse error, expecting `BETWEEN', `IN', or `SQL_TOKEN_LIKE'


The 'Our Ref' field has our reference, the last five characters of which are a number. I want to return the record with the highest number, so that we know which number to use next.

Can anyone help?

Russ
Back to top
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sat Feb 14, 2004 10:34 am    Post subject: Reply with quote

There are 8 references to "parse error" in these forums. Most of which lead to a suggested solution ... set on "Run SQL Directly".
for example:
http://www.oooforum.org/forum/viewtopic.php?p=18656&highlight=parse+error#18656

Did you have that setting ?
Back to top
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sat Feb 14, 2004 10:51 am    Post subject: Reply with quote

MySQl supports autoincrement which may be a better way of implementing your which number to use next especially if the database becomes large or has to support concurrent update-access.
Back to top
View user's profile Send private message
avantman42
Super User
Super User


Joined: 28 Jul 2003
Posts: 751
Location: Staffordshire, UK

PostPosted: Sun Feb 15, 2004 11:38 pm    Post subject: Reply with quote

Thanks dfrench,

By the time I posted that message, I'd spent most of the afternoon trying to get something working, including a lot of time searching this forum. For some reason I didn't search for 'parse error' Embarassed

I now have the LIMIT working, but I cannot add new rows. Presumably this is because of the LIMIT.

Quote:

MySQl supports autoincrement which may be a better way of implementing your which number to use next especially if the database becomes large or has to support concurrent update-access


I know. At the moment, it's not too large, and it doesn't have to support concurrent update access. I'm trying to create something similar to an MS Works database, because that's the only way I can get my boss to switch Rolling Eyes My hope is that I'll be able to convince him of the advantages of proper database design later.

Russ
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group