Solved

Convert this query int LINQ..possible??

Posted on 2013-11-20
1
255 Views
Last Modified: 2016-02-10
Hello, I would like, if possible, to convert this SQL query into LINQ. Basically is a group query that joins to itself.

select t1.invoiceno  from testdups as t1
left join testdups as t2 on t1.InvoiceNo = t2.invoiceno
where t1.IsInvoice <> t2.IsInvoice
group by t1.invoiceno
having count(t1.invoiceno)> 1

thanks!
0
Comment
Question by:arcross
1 Comment
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39662714
Hi arcross;

Give this a try to see if it comes out with what you are looking for.

Dim result = From t1 in DataContextInstance.testdups _
             Join t2 in DataContextInstance.testdups On t1.InvoiceNo = t2.InvoiceNo _
             Where t1.IsInvoice <> t2.IsInvoice _
             Group t1 By Key = t1.InvoiceNo Into Group _
             Where Group.Count > 1 _
             Select Group.Key

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 Populate DataModel with DataTable 44 38
VB.Net Determine if a mapped network drive exists 2 30
Need syntax help building hyperlink 2 25
Code enhancement 4 21
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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