| View previous topic :: View next topic |
| Author |
Message |
avantman42 Super User

Joined: 28 Jul 2003 Posts: 751 Location: Staffordshire, UK
|
Posted: Thu Feb 12, 2004 9:05 am Post subject: SQL LIMIT on MySQL/ODBC connection |
|
|
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 |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Sat Feb 14, 2004 10:51 am Post subject: |
|
|
| 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 |
|
 |
avantman42 Super User

Joined: 28 Jul 2003 Posts: 751 Location: Staffordshire, UK
|
Posted: Sun Feb 15, 2004 11:38 pm Post subject: |
|
|
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'
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 My hope is that I'll be able to convince him of the advantages of proper database design later.
Russ |
|
| Back to top |
|
 |
|
|
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
|