StringBuffer sql = new StringBuffer(512); sql.append("SELECT ThreadID, ForumID, MemberName, LastPostMemberName, ThreadTopic, ThreadBody"); sql.append(" FROM " + TABLE_NAME); sql.append(" ORDER BY " + sort + " " + order); sql.append(" LIMIT ?, ?");
What is LIMIT? What do those question marks stand for?
Joined: Mar 16, 2004
LIMIT I think is a MySQL-only SQL (I don't /think/ its in ANSI SQL-2, but I'd have to check). Its used to limit the amount of rows returned from a query expression e.g. LIMIT 10 would return a maximum of 10 results, even if the query expression could find more. You get similar thing in other DBs - SQL Server uses TOP in the same way for example. The question marks are there to allow paramater binding. You would run this as a PreparedStatement and supply bind values to substitute in to the ?. That being said, I think LIMIT can only take one arguement, so I'd be surprised if the query works.