error while querying access database

I am trying to figure out what is wrong with this simple query. I'm trying to sum few columns and group it by the id primary key and then I want to extract the max number using the 'TOP 1' on descending order by. when I'm adding the line ORDER BY sumofTotal DESC I get this error from the visual studio server explorer:

SELECT        TOP 1 ID, SUM(K + L + M + N + AD + AR) AS sumofTotal
FROM            Calculator
GROUP BY ID
ORDER BY sumofTotal DESC

Answers


SumOfTotal isn't a column in this search, it is a column heading.

You need:

SELECT        TOP 1 ID, SUM(K + L + M + N + AD + AR) AS sumofTotal
FROM            Calculator
GROUP BY ID
ORDER BY SUM(K + L + M + N + AD + AR) DESC

Need Your Help

Where are my DataModel classes after added ADO.NET Entity Data Model

c# entity-framework asp.net-mvc-4

Ok after finally getting the correct connection string to create the Mdf file in the App_Data folder. I tried to add a ADO.NET Entity Data Model to the Models folder following the tutorial in "Begi...

DTO or Domain Model Object in the View Layer?

model dto data-transfer-objects

I know this is probably an age-old question, but what is the better practice? Using a domain model object throughout all layers of your application, and even binding values directly to them on the...