Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. Shipments ShipmentNomenclatures Nomenclatures Products
  2. id id id id
  3. shipment_id model_id nomenclature_id
  4. nomenclature_id vendorCode showroom_id
  5.  
  6. ShimpentViewModel
  7. Все поля из Shipment
  8. Models
  9. VendorCodes
  10.  
  11. var shipmentViewModels = _dbContext.Value.ShipmentViewModels.FromSql (" SELECT [p].[Id],
  12. SUBSTRING((SELECT COALESCE(', ' + [sn.Nomenclature.Model].[Name], '') [text()]
  13. FROM ShipmentNomenclatures AS sn
  14. INNER JOIN [Nomenclatures] AS [sn.Nomenclature] ON [sn].[NomenclatureId] = [sn.Nomenclature].[Id]
  15. INNER JOIN [Models] AS[sn.Nomenclature.Model] ON [sn.Nomenclature].[ModelId] = [sn.Nomenclature.Model].[Id]
  16. WHERE [sn].[ShipmentId] = p.Id
  17. ORDER BY 1
  18. FOR XML PATH ('')
  19. ), 2, 1000) AS [Models]
  20.  
  21. ,SUBSTRING((SELECT COALESCE (', ' + [sn.Nomenclature].[VendorCode], '') [text()]
  22. FROM ShipmentNomenclatures AS sn
  23. INNER JOIN [Nomenclatures] AS[sn.Nomenclature] ON [sn].[NomenclatureId] = [sn.Nomenclature].[Id]
  24. WHERE [sn].[ShipmentId] = p.Id
  25. ORDER BY 1
  26. FOR XML PATH ('')
  27. ), 2, 1000) AS [VendorCodes]
  28. FROM [Shipments] AS [p] ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement