#375 - javax.persistence.PersistenceException: Query threw SQLException:Incorrect syntax near the keyword distinct

This commit is contained in:
Robin Bygrave
2015-08-06 19:30:57 +12:00
parent 93f802f7fe
commit 3a9668fe6c
@@ -31,10 +31,11 @@ public class MsSqlServer2005SqlLimiter implements SqlLimiter {
if (firstRow < 1) {
// just use top n
sb.append(" select top ").append(lastRow).append(" ");
sb.append(" select ");
if (request.isDistinct()) {
sb.append("distinct ");
}
sb.append(" top ").append(lastRow).append(" ");
sb.append(request.getDbSql());
return new SqlLimitResponse(sb.toString(), false);
}