Solved

Convert this query int LINQ..possible??

Posted on 2013-11-20
1
248 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 62

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help parsing JSON in my VB.Net application 4 47
LINQ - C# to VB convertion 12 48
Help with LINQ and XML 10 28
Close form "before" open 3 30
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now