EF核心如何加入%
因此,我试图加入3张桌子,而我需要的一张连接是匹配最终还有其他东西的Sku。 前任。 'werty123'to'Werty123blah'
此SQL查询在Microsoft SQL Server中起作用。
SELECT b.ModifyDate, p.IsEmbroidery, p.IsEngraving, p.IsMetal, p.IsUv
FROM BarcodeScan b
INNER JOIN ShipStationAwaitingOrder s ON b.ShipStationOrderId = s.SSOrderId
INNER JOIN Product p ON s.ItemSKU LIKE p.Sku + '%'
WHERE b.ModifyDate LIKE '2022-06-07'+'%'
这是我的linq查询。
var TodaysList = (
from b in _context.BarcodeScan
join so in _context.ShipStationAwaitingOrder
on b.ShipStationOrderId equals so.SSOrderId
join p in _context.Product
on so.ItemSku equals p.Sku + '%'
where EF.Functions.Like(b.ModifyDate.Date.ToString(), nowTime.Date.ToString())
select (new
{
ModifyDate = b.ModifyDate,
SKU = so.ItemSku,
IsEmbroidery = p.IsEmbroidery,
IsEngraving = p.IsEngraving,
IsMetal = p.IsMetal,
IsUV = p.IsUv
})
).ToList();
如何使用P.Sku +'%'进行“平等”?
So I am trying to join 3 tables and one of the joins i need to match up sku's that have additional stuff on the end.
ex. 'WERTY123' to 'WERTY123blah'
this SQL query works in Microsoft SQL server.
SELECT b.ModifyDate, p.IsEmbroidery, p.IsEngraving, p.IsMetal, p.IsUv
FROM BarcodeScan b
INNER JOIN ShipStationAwaitingOrder s ON b.ShipStationOrderId = s.SSOrderId
INNER JOIN Product p ON s.ItemSKU LIKE p.Sku + '%'
WHERE b.ModifyDate LIKE '2022-06-07'+'%'
and this is my linq query.
var TodaysList = (
from b in _context.BarcodeScan
join so in _context.ShipStationAwaitingOrder
on b.ShipStationOrderId equals so.SSOrderId
join p in _context.Product
on so.ItemSku equals p.Sku + '%'
where EF.Functions.Like(b.ModifyDate.Date.ToString(), nowTime.Date.ToString())
select (new
{
ModifyDate = b.ModifyDate,
SKU = so.ItemSku,
IsEmbroidery = p.IsEmbroidery,
IsEngraving = p.IsEngraving,
IsMetal = p.IsMetal,
IsUV = p.IsUv
})
).ToList();
How can I do the 'equals' with p.Sku + '%' ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论