преобразовать запрос SQL в LINQ Online
select * from employee where ID = 1
Adventurous Angelfish
select * from employee where ID = 1
SELECT DATEPART(Year, CreationDate) AS Year, DATEPART(Month, CreationDate) AS Month, COUNT(*) AS NoRecords
FROM QAACHE.xxxxx
GROUP BY DATEPART(Year, CreationDate), DATEPART(Month, CreationDate)
"Select [Supplier Name] as Supplier_Name,MIN(Invoice_ID) as Invoice_ID, MIN(LogDated) as LogDated," +
"IIF(MIN(CAST([Traning Locked] as Nvarchar(1)))=1,'True','False') As[Training_Locked],"+
"Sum(IIF([OCR Exception] IS NOT NULL, 1, 0)) as [With_OCR_Exception],"+
"Sum(IIF([OCR Exception] IS NULL, 1, 0)) as [Without_OCR_Exception],"+
"COUNT([Invoice_ID]) as [Total],"+
"CAST((Sum(IIF([OCR Exception] IS not NULL, 1, 0)) * 100.0 / Count([Invoice_ID]))/100.0 as decimal(10, 3)) as [Percent]"+
"from[dbo].[qry_AllInvoiceOCRException] where AutomationStatus like '%Completed%' and ([Supplier Name] != '' or[Supplier Name] is not null)"+
"Group By[Supplier Name]"
SELECT*FROM FacturaDetalle1 facturaDetalleBase
RIGHT JOIN FacturaDetalle2 facturaDetalle ON facturaDetalle.Articulo_key <> facturaDetalleBase.Articulo_key
SELECT [c].[CardID], [c].[AttributeChangeDate], [c].[CardAuthData], [c].[CardBlockFlags], [c].[CardBlocked], [c].[CardCreateDate], [c].[CardExpireDate], [c].[CardExtRefID], [c].[CardState_LuID], [c].[GenerationID], [c].[IdType_LuID], [c].[LastUsedDate], [c].[MaxPinAttempts], [c].[PatronID], [c].[PinFailed], [c].[Signature], [p].[PatronID], [p].[AttributeChangeDate], [p].[Class], [p].[DailyDepositDate], [p].[DailyDepositLimit], [p].[DailyDepositTotal], [p].[EgmDepositEnabled], [p].[EgmWithdrawEnabled], [p].[FirstName], [p].[LastName], [p].[PatronCreateDate], [p].[PatronExtRefID], [p].[PatronType_LuID], [p].[SystemDepositEnabled], [p].[SystemWithdrawEnabled], [t].[AccountID], [t].[AccountActivationDate], [t].[AccountBlockFlags], [t].[AccountBlocked], [t].[AccountCreateDate], [t].[AccountDescription], [t].[AccountExpireDate], [t].[AccountState_LuID], [t].[AccountType_LuID], [t].[AttributeChangeDate], [t].[AuthRequired], [t].[Balance], [t].[DefaultWithdrawAmount], [t].[DepositMax], [t].[DepositOk], [t].[EgmDepositMax], [t].[EgmWithdrawMax], [t].[LastTransferDate], [t].[LastTxnID], [t].[LastUpdateDate], [t].[MaxAllowedBalance], [t].[PatronID], [t].[ProcessingLock], [t].[SelectAmount], [t].[Signature], [t].[WithdrawMax], [t].[WithdrawOk], [t].[AccountID0], [t].[TxnID], [t].[CardID], [t].[ClientID], [t].[ClientTxnID], [t].[ClientType_LuID], [t].[CommitMsgTime], [t].[CommitStartTime], [t].[CurrentBalance], [t].[DeviceID], [t].[DeviceLocation], [t].[InitStartTime], [t].[MasterTxnID], [t].[OverrideUserSeq], [t].[PreviousBalance], [t].[RemoteClientID], [t].[RemoteClientType_LuID], [t].[RemoteSiteID], [t].[ResourceID], [t].[Signature0], [t].[TransferAmount], [t].[TxnReason_LuID], [t].[TxnType_LuID], [t].[VoidTxnID], [t].[WalletID], [t].[WalletPostBalance], [t].[user_seq]
FROM [wat].[Card] AS [c]
INNER JOIN [wat].[Patron] AS [p] ON [c].[PatronID] = [p].[PatronID]
LEFT JOIN (
SELECT [a].[AccountID], [a].[AccountActivationDate], [a].[AccountBlockFlags], [a].[AccountBlocked], [a].[AccountCreateDate], [a].[AccountDescription], [a].[AccountExpireDate], [a].[AccountState_LuID], [a].[AccountType_LuID], [a].[AttributeChangeDate], [a].[AuthRequired], [a].[Balance], [a].[DefaultWithdrawAmount], [a].[DepositMax], [a].[DepositOk], [a].[EgmDepositMax], [a].[EgmWithdrawMax], [a].[LastTransferDate], [a].[LastTxnID], [a].[LastUpdateDate], [a].[MaxAllowedBalance], [a].[PatronID], [a].[ProcessingLock], [a].[SelectAmount], [a].[Signature], [a].[WithdrawMax], [a].[WithdrawOk], [a0].[AccountID] AS [AccountID0], [a0].[TxnID], [a0].[CardID], [a0].[ClientID], [a0].[ClientTxnID], [a0].[ClientType_LuID], [a0].[CommitMsgTime], [a0].[CommitStartTime], [a0].[CurrentBalance], [a0].[DeviceID], [a0].[DeviceLocation], [a0].[InitStartTime], [a0].[MasterTxnID], [a0].[OverrideUserSeq], [a0].[PreviousBalance], [a0].[RemoteClientID], [a0].[RemoteClientType_LuID], [a0].[RemoteSiteID], [a0].[ResourceID], [a0].[Signature] AS [Signature0], [a0].[TransferAmount], [a0].[TxnReason_LuID], [a0].[TxnType_LuID], [a0].[VoidTxnID], [a0].[WalletID], [a0].[WalletPostBalance], [a0].[user_seq]
FROM [wat].[Account] AS [a]
LEFT JOIN [wat].[AccountTxn] AS [a0] ON [a].[AccountID] = [a0].[AccountID] and [a0].TxnID = [a].LastTxnID
) AS [t] ON [p].[PatronID] = [t].[PatronID]
WHERE [c].[CardExtRefID] = 12345665000100153558
ORDER BY [c].[CardID], [p].[PatronID], [t].[AccountID], [t].[AccountID0]
select * from VendorTicket (nolock) where IncidentID in (select IncidentID from Incident (nolock) where ClosedDate is null) and VendorID!=3 order by TicketID
from location in _context.Businessunit
where request.locationId.Contains(location.Id)
join client in _context.Businessunit on location.Parentbusinessunitid equals client.Id
join building in _context.Area on location.AddressId equals building.AddressId
where building.Appcategoryname == "Building" && building.IsEnable == true
join floor in _context.Area on building.Id equals floor.Parentareaid
where floor.Appcategoryname == "Floor" && building.IsEnable == true
join department in _context.Area on floor.Id equals department.Parentareaid
where department.Appcategoryname == "Department" && building.IsEnable == true
join equipment in _context.Equipment on department.Id equals equipment.Areaid
join device in _context.Device on equipment.Id equals device.Equipmentid
where device.IsEnable == true
select new
{
deviceId = device.Id,
deviceName = device.Devicename,
deviceNummber = device.DeviceNumber,
isConnected = device.IsConnected,
lastConnected = device.LastConnected,
lastSprayCycle = device.LastActualCommunicatedAt,
location_name = location.Name,
customer = client.Name,
building_name = building.AreaName,
floor_name = floor.AreaName,
department_name = department.AreaName,
}
from location in _context.Businessunit
where request.locationId.Contains(location.Id)
join client in _context.Businessunit on location.Parentbusinessunitid equals client.Id
join building in _context.Area on location.AddressId equals building.AddressId
where building.Appcategoryname == "Building" && building.IsEnable == true
join floor in _context.Area on building.Id equals floor.Parentareaid
where floor.Appcategoryname == "Floor" && building.IsEnable == true
join department in _context.Area on floor.Id equals department.Parentareaid
where department.Appcategoryname == "Department" && building.IsEnable == true
join equipment in _context.Equipment on department.Id equals equipment.Areaid
join device in _context.Device on equipment.Id equals device.Equipmentid
where device.IsEnable == true
select new
{
deviceId = device.Id,
deviceName = device.Devicename,
deviceNummber = device.DeviceNumber,
isConnected = device.IsConnected,
lastConnected = device.LastConnected,
lastSprayCycle = device.LastActualCommunicatedAt,
location_name = location.Name,
customer = client.Name,
building_name = building.AreaName,
floor_name = floor.AreaName,
department_name = department.AreaName,
}
SELECT COUNT(Products.Id), Category.Name FROM Users
JOIN ProductUser ON ProductUser.FansId = Users.Id
JOIN Products ON ProductUser.FavoritesId = Products.Id
JOIN Category ON Products.CategoryId = Category.Id
GROUP BY Category.Name
SELECT * FROM HISUsersBasePermission WHERE ID_Sub IS NULL and Code in(1)