The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
22 views

convert select query to linq on sql server 2008

I have two tables: Album(AlbumId, AlbumName) and Photo(PhotoId, PhotoName, AlbumId) I have : select top 1 Photo.PhotoId from Photo where Album.AlbumId=Photo.AlbumId order by NEWID() This is ...
4
votes
2answers
80 views

Converting an SQL query in to LINQ C#

I've an SQL Query: SELECT node.GroupName , depth = COUNT(parent.GroupName) - 1 FROM CompanyGroup node JOIN CompanyGroup parent ON node.LeftID BETWEEN parent.LeftID AND parent.RightID GROUP ...
2
votes
1answer
31 views

How to write a Linq query equivalent to this SQL

I'm trying to figure out how to write a linq query that will return equivalent results to the sql query below. The problem I'm having has to do with the two select count queries included in the ...
0
votes
1answer
31 views

How to write lambda (linq) expression for sql?

I have an Sql statement for which I need go generate corresponding Lambda Expression (Linq). Here is the SQL Declare @CurrentUserId as int Declare @CurrentDate as datetime Set @CurrentDate = ...
0
votes
1answer
42 views

SQL: Row_number in linq?

This is my sql query, , select ROW_NUMBER() over (partition by AirAvail_ID order by AirAvail_ID) as IndexNo,AirAvail_ID from AvailFlt I would like to convert this to LINQ! O/P: IndexNo ...
1
vote
1answer
74 views

How can I convert sql to linq

This is my SQL query SELECT sys.sysobjects.name Name, sys.foreign_keys.* FROM sys.foreign_keys inner join sys.sysobjects on sys.foreign_keys.parent_object_id = sys.sysobjects.id WHERE ...
0
votes
1answer
46 views

Convert Count … Group By From SQL Query To LINQ

Please help me convert the MSSQL below to LINQ. SELECT A.id, A.type, COUNT(IIf(B.BookId IS NOT NULL, 0, null)) AS TotalCount FROM Store A LEFT JOIN Book B ON A.id = B.id GROUP BY A.id, A.type; I ...
3
votes
2answers
96 views

Convert SQL into Linq query

I'm quite new at Linq queries, I just want to convert my DB query into Linq. Here is my simple SQL query: var query = "SELECT EnrollmentDate, COUNT(*) AS StudentCount " + "FROM Person " ...
1
vote
5answers
86 views

Convert SQL query with an “In” condition to Lambda expression

This may be quite simple, but unfortunately I have a difficulty in figuring out converting an SQL query with an "In" condition to lambda. SELECT * FROM cm_wfapp WHERE recgid IN (select distinct ...
0
votes
0answers
43 views

Convert SQL query into LINQ query in VB

I would like to know how to convert the SQL query listed below into a LINQ query in VB: SELECT * FROM (SELECT SUM(t.Amt) Tax, g.GenQuoteDetails_Id, g.lastTkdt, g.QuoteDt, g.BaseFareCurrency, ...
4
votes
2answers
129 views

Using LINQ find nearby places from database

We want to receive list of nearby places from database using LINQ in ASP.NET 2012 and would like some feedback on our strategy. My table and fake data: PlaceId Name Latitude ...
-2
votes
2answers
65 views

SQL to LINQ orderby specific order

select Priority, case Priority when 'Medium' then (Count(*)* 100 / (Select Count(*) From #tem where Priority = 'Medium')) when 'High' then (Count(*)* 100 / (Select Count(*) From #tem ...
0
votes
3answers
61 views

WITH statement in LINQ Entity Framework

I got a SQL code like this which I'm going to use in a .NET application, I'm familiar with LINQ but I don't know what to do with the WITH statement. WITH records AS ( SELECT [key], [rev], ...
0
votes
2answers
54 views

How to write lambda expression for an sql expression?

I have an SQL expression select S.SpecialtyName, COUNT(distinct SUC.SiteUserId) as Subscribers from SiteUserContent SUC Inner join Specialties S on SUC.SpecialtyId = S.SpecialtyId Inner ...
2
votes
2answers
191 views

Multiple Join and Group By LINQ

I need to generate this data model (example): IList<FeatureGroupFeaturesDto> fcf = new List<FeatureGroupFeaturesDto>(); fcf.Add(new FeatureGroupFeaturesDto { FeatureGroup = new ...

1 2 3 4
15 30 50 per page