Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

linq to sql how to get column totals

Posted on 2009-07-15
2
Medium Priority
?
211 Views
Last Modified: 2013-11-11
I have created a sql server view and am using linq to sql to read it.

  var testQuery = (from customers in dc.viewCustomers                                    
                                    selectcustomers);

Now the query returns column totalprice that is a money datatype in sql server

I want to amend the query so I get the SUM of totalprice.  
     

These are all
0
Comment
Question by:mugsey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 12

Accepted Solution

by:
GuitarRich earned 2000 total points
ID: 24857729
try this:
decimal totalPriceSum = (from customers in dc.viewCustomers
                         select customers.totalprice).Sum();

Open in new window

0
 
LVL 12

Expert Comment

by:GuitarRich
ID: 24857732
this page has loads of good examples that help me with LINQ http://msdn.microsoft.com/en-us/vbasic/bb688085.aspx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question