Solved

Convert this query int LINQ..possible??

Posted on 2013-11-20
1
247 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

12 Experts available now in Live!

Get 1:1 Help Now