Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

specifying a limit parameter creates incorrect MySQL query, MySQL doesn't support the TOP keyword #76

Closed
sringel opened this Issue · 2 comments

2 participants

@sringel

Example:
var videos = new Videos();
var headlines = videos.All(where: "headline = @0", orderBy: "`create` DESC", limit: 5, columns: "videoid", args: 1);

Create a SQL query like "SELECT TOP 5 videoid FROM videos WHERE headline = 1 ORDER BY create DESC;", which MySQL throws the following error:

/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '5 videoid FROM videos WHERE headline = 1 ORDER BY create DESC' at line 1 */

Workaround using Linq:

var videos = new Videos();
var headlines = videos.All(where: "headline = @0", orderBy: "`create` DESC", columns: "videoid", args: 1).Take(5);

@robconery
Collaborator

Right - this isn't an issue, it's a given. Remember, this is a code file - not a DLL or toolset. If you're using MySQL, you'll need LIMIT instead of TOP.

@robconery robconery closed this
@sringel

No problem, my mistake, I misread the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.