Avatar of RobertNZana
RobertNZana
Flag for United States of America

asked on 

How LIMIT MySql Query to top 10 rows - Error in SELECT clause: expression near '10'. Unable to parse query text.

Using latest versions of both ASP.NET and MySQL.  I want to create a query returning only the TOP 10 rows of data, but using LIMIT does not seem to work.  (This is a query within an XSD dataset.)

I've tried:
LIMIT 10
LIMIT 0,10
Putting the LIMIT after the WHERE and after the ORDER BY

The TableAdapter Query Configuration Wizard tells me:  Error in SELECT clause: expression near '10'. Unable to parse query text.

What am I missing?
SELECT     counties.County, states.UsStateAbbreviation, projects.ProjectId, projects.ProjectTitle
FROM         states INNER JOIN
                      counties ON states.StateId = counties.StateId INNER JOIN
                      projects ON counties.CountyId = projects.LocationCountyId
LIMIT 10
WHERE     (projects.IsVisible = 1) AND (projects.ReleaseDate <= CURDATE()) AND (projects.IsPrivate = 0)
ORDER BY projects.BidDateTime DESC

Open in new window

ASP.NETMySQL Server

Avatar of undefined
Last Comment
fabioce

8/22/2022 - Mon