Skip to content

Instantly share code, notes, and snippets.

@marto83
Created December 14, 2012 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marto83/4283933 to your computer and use it in GitHub Desktop.
Save marto83/4283933 to your computer and use it in GitHub Desktop.
New Query after config change
SELECT [Project2].[Id] AS [Id],
[Project2].[OrderId] AS [OrderId],
[Project2].[Name] AS [Name],
[Project2].[Email] AS [Email],
[Project2].[ChargeType] AS [ChargeType],
[Project2].[Status] AS [Status],
[Project2].[Created] AS [Created],
[Project2].[Updated] AS [Updated],
[Project2].[Id1] AS [Id1],
[Project2].[Addressee] AS [Addressee],
[Project2].[AddressLine1] AS [AddressLine1],
[Project2].[AddressLine2] AS [AddressLine2],
[Project2].[AddressLine3] AS [AddressLine3],
[Project2].[Town] AS [Town],
[Project2].[County] AS [County],
[Project2].[Country] AS [Country],
[Project2].[Postcode] AS [Postcode],
[Project2].[Id2] AS [Id2],
[Project2].[Addressee1] AS [Addressee1],
[Project2].[AddressLine11] AS [AddressLine11],
[Project2].[AddressLine21] AS [AddressLine21],
[Project2].[AddressLine31] AS [AddressLine31],
[Project2].[Town1] AS [Town1],
[Project2].[County1] AS [County1],
[Project2].[Country1] AS [Country1],
[Project2].[Postcode1] AS [Postcode1],
[Project2].[C1] AS [C1],
[Project2].[Id3] AS [Id3],
[Project2].[Description] AS [Description],
[Project2].[UnitPrice] AS [UnitPrice],
[Project2].[Quantity] AS [Quantity],
[Project2].[SKU] AS [SKU],
[Project2].[ShippingCost] AS [ShippingCost],
[Project2].[Tax] AS [Tax],
[Project2].[Order_Id] AS [Order_Id]
FROM (SELECT [Limit1].[Id] AS [Id],
[Limit1].[OrderId] AS [OrderId],
[Limit1].[Name] AS [Name],
[Limit1].[Email] AS [Email],
[Limit1].[ChargeType] AS [ChargeType],
[Limit1].[Status] AS [Status],
[Limit1].[Created] AS [Created],
[Limit1].[Updated] AS [Updated],
[Limit1].[Id1] AS [Id1],
[Limit1].[Addressee] AS [Addressee],
[Limit1].[AddressLine1] AS [AddressLine1],
[Limit1].[AddressLine2] AS [AddressLine2],
[Limit1].[AddressLine3] AS [AddressLine3],
[Limit1].[Town] AS [Town],
[Limit1].[County] AS [County],
[Limit1].[Country] AS [Country],
[Limit1].[Postcode] AS [Postcode],
[Limit1].[Id2] AS [Id2],
[Limit1].[Addressee1] AS [Addressee1],
[Limit1].[AddressLine11] AS [AddressLine11],
[Limit1].[AddressLine21] AS [AddressLine21],
[Limit1].[AddressLine31] AS [AddressLine31],
[Limit1].[Town1] AS [Town1],
[Limit1].[County1] AS [County1],
[Limit1].[Country1] AS [Country1],
[Limit1].[Postcode1] AS [Postcode1],
[Extent4].[Id] AS [Id3],
[Extent4].[Description] AS [Description],
[Extent4].[UnitPrice] AS [UnitPrice],
[Extent4].[Quantity] AS [Quantity],
[Extent4].[SKU] AS [SKU],
[Extent4].[ShippingCost] AS [ShippingCost],
[Extent4].[Tax] AS [Tax],
[Extent4].[Order_Id] AS [Order_Id],
CASE
WHEN ([Extent4].[Id] IS NULL) THEN CAST(NULL AS int)
ELSE 1
END AS [C1]
FROM (SELECT TOP (1) [Extent1].[Id] AS [Id],
[Extent1].[OrderId] AS [OrderId],
[Extent1].[Name] AS [Name],
[Extent1].[Email] AS [Email],
[Extent1].[ChargeType] AS [ChargeType],
[Extent1].[Status] AS [Status],
[Extent1].[Created] AS [Created],
[Extent1].[Updated] AS [Updated],
[Extent2].[Id] AS [Id1],
[Extent2].[Addressee] AS [Addressee],
[Extent2].[AddressLine1] AS [AddressLine1],
[Extent2].[AddressLine2] AS [AddressLine2],
[Extent2].[AddressLine3] AS [AddressLine3],
[Extent2].[Town] AS [Town],
[Extent2].[County] AS [County],
[Extent2].[Country] AS [Country],
[Extent2].[Postcode] AS [Postcode],
[Extent3].[Id] AS [Id2],
[Extent3].[Addressee] AS [Addressee1],
[Extent3].[AddressLine1] AS [AddressLine11],
[Extent3].[AddressLine2] AS [AddressLine21],
[Extent3].[AddressLine3] AS [AddressLine31],
[Extent3].[Town] AS [Town1],
[Extent3].[County] AS [County1],
[Extent3].[Country] AS [Country1],
[Extent3].[Postcode] AS [Postcode1]
FROM [dbo].[Orders] AS [Extent1]
LEFT OUTER JOIN [dbo].[Addresses] AS [Extent2]
ON [Extent1].[BillingAddress_Id] = [Extent2].[Id]
LEFT OUTER JOIN [dbo].[Addresses] AS [Extent3]
ON [Extent1].[DeliveryAddress_Id] = [Extent3].[Id]
WHERE [Extent1].[OrderId] = 'Test-9925c1f1' /* @p__linq__0 */) AS [Limit1]
LEFT OUTER JOIN [dbo].[OrderLines] AS [Extent4]
ON [Limit1].[Id] = [Extent4].[Order_Id]) AS [Project2]
ORDER BY [Project2].[Id] ASC,
[Project2].[Id1] ASC,
[Project2].[Id2] ASC,
[Project2].[C1] ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment