Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hai good evening to all please help me how to convert "order by Displayby asc,newid()" this sql query to linq.



thanks in advance
By
Meganathan M
Posted
Updated 26-Feb-18 2:31am

Try this link:

http://www.sqltolinq.com/[^]

You can download software to Convert Sql to linq or vise versa.

Thanks
 
Share this answer
 
hi,

try like these
SQL
var x =from p in db.Persons orderby a.FirstName descending select p;

the word displayby is not a sql keyword
and for newid()
have look at this link
 
Share this answer
 
v2
SQL
select Id,ScheduleDate,TimeSlot,DecommissionedDate from lnkRegScheduleDate
where ID = (Select Max(Id) from lnkRegScheduleDate where  RegId = @RegId)
 
Share this answer
 
SQL
SELECT     Engineering.IncomingDetail.DocumentId, MAX(Engineering.IncomingHeader.DccReceivedDate) AS maxDccReceivedDate
FROM         Engineering.IncomingHeader INNER JOIN
                      Engineering.IncomingDetail ON Engineering.IncomingHeader.ID = Engineering.IncomingDetail.IncomingHeaderId INNER JOIN
                      Engineering.[Document] ON Engineering.IncomingDetail.DocumentId = Engineering.[Document].ID
WHERE     (Engineering.[Document].IsOmit = 0)
GROUP BY Engineering.IncomingDetail.DocumentId
 
Share this answer
 
Hi,
You can try this one....

var Query = from temp in db.Employee orderby temp.Displayby ascending select temp;
Employee objemp = new Employee();
string newid = objemp.Id.ToString();
 
Share this answer
 
SQL
Select BrandDescription, CAPEXLookUp, count (*) frpm CAPEXRecord
            inner join Facility on CAPEXRecord.facilityId= facility.facilityId
            inner join FacilityBrand on facility.facilityBrand=facilityBrand.FacilityBrandId
            inner join CAPEXLookUp on CapexLookUp.LookUpId= CAPEXRecord.lookupId
            group by facilitybrand.branddescription, CAPEXLookUp.Description
 
Share this answer
 
select top 10 * from customerReviews where reviewid not in (select top 2 reviewid from customerReviews);
 
Share this answer
 
select max(codigo) from Provisiones
where IdPeriodo = 13 and IdCentroCosto in (
select IdCentroCosto from CentroCostos where IdCompania = 1)
 
Share this answer
 
SELECT CAST(a.FechaIngreso AS DATE),p.Apellido,
SUM(CASE WHEN ag.Id is NULL THEN 0 ELSE 1 END) AS Generales,
SUM(CASE WHEN ld.Id is NULL THEN 0 ELSE 1 END) AS Leyes,
SUM(CASE WHEN aa.Id is NULL THEN 0 ELSE 1 END) AS ModificadoGenerales,
SUM(CASE WHEN ald.Id is NULL THEN 0 ELSE 1 END) AS ModificadoLeyes
FROM dbo.Avisos a
LEFT JOIN dbo.Aviso_Generales ag ON a.id = ag.Id
LEFT JOIN dbo.Avisos_LeyesDecretos ld ON a.id = ld.id
LEFT JOIN dbo.AvisosAuditoria aa ON aa.AvisoId = a.Id
LEFT JOIN dbo.AvisoAuditoria_Generales aag ON aa.Id = aag.Id
LEFT JOIN dbo.AvisosAuditoria_LeyesDecretos ald ON aa.id = ald.id
INNER JOIN dbo.Personas p ON a.PersonaId = p.Id
WHERE a.FechaIngreso >= '20180222'
GROUP BY CAST(a.FechaIngreso AS DATE),p.Apellido
 
Share this answer
 
Comments
Richard MacCutchan 26-Feb-18 9:13am    
SIX years too late.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900