I am using Webmatrix to develop a pretty nifty site ad was wondering how to limit the db query so that I only get the last 5 rows. I know php well and know how to write it for there and it looks like the query string is similar, but when I try to add the LIMIT in there it gives me mass errors.
var db = Database.Open("PhotoGallery");
var races = db.Query("SELECT * FROM Races ORDER BY id DESC LIMIT 5");
Any help would be great, I could have swore I found an answer somewhere but when I search google now for “cshtml/razor limit db query” it comes up with everything but what I’m looking for and the one site that briefly mentioned it said its the same exact layout as if you were writing the string in php. So I’m lost and here now lol. Thank you in advance.
You’re trying to limit a SQL Server query: