?
Solved

C# - Linq Statement Help

Posted on 2015-02-20
2
Medium Priority
?
60 Views
Last Modified: 2015-02-23
Anyone have an idea how I can get this data into a LINQ statement example?

SELECT GP.StatusGroupID, GP.StatusGroupName,
       MONTH(IV.PeriodEndDate) PEMonth, YEAR(IV.PeriodEndDate) PEYear,
       COUNT(*) InvCount
 FROM [Customer].[dbo].[invInvoice] IV
 INNER JOIN [Customer].[dbo].[invStatus] ST ON IV.StatusID = ST.StatusID
 INNER JOIN [Customer].[dbo].[invStatusGroup] GP ON ST.StatusGroupID = GP.StatusGroupID
   WHERE
      IV.PeriodEndDate >= DATEADD(MONTH, -11, DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)) AND
      IV.PeriodEndDate < DATEADD(MONTH, 1, DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0))
GROUP BY GP.StatusGroupID, StatusGroupName, MONTH(IV.PeriodEndDate), YEAR(IV.PeriodEndDate)
ORDER BY PEYear, PEMonth, StatusGroupID
0
Comment
Question by:sbornstein2
[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 Comments
 
LVL 15

Accepted Solution

by:
Lokesh B R earned 2000 total points
ID: 40625153
var result = (from iv in db.[invInvoice]
             join st in db.[invStatus] on iv.StatusID equals st.StatusID
	     join gp in db.[invStatusGroup] on st.StatusGroupID equals gp.StatusGroupID
	     group iv by new { gp.StatusGroupID, gp.StatusGroupName,
       IV.PeriodEndDate.Month, IV.PeriodEndDate.Year, COUNT(*)} into r
select new
{

  StatusGroupID =  r.Key.StatusGroupID,
StatusGroupName = r.Key.StatusGroupName,
// and so on...


}).ToList();

Open in new window

0
 

Author Closing Comment

by:sbornstein2
ID: 40626737
tx
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

743 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