----------->SELECT tInventoryWebData.InventoryID, WebTitle, tInventoryWebData.URLKey FROM tInventoryWebData WHERE tInventoryWebData.InventoryID = '{792d0998-af2c-4aba-8682-90d0df0b7b54}' And DisplayOnWebSite = 1 And tInventoryWebData.CompanyID = '00000000-0000-0000-0000-000000000005' ORDER BY WebTitle<----------------------->SELECT * FROM tConfiguration WHERE CompanyID = '00000000-0000-0000-0000-000000000005' OR CompanyID = '{00000000-0000-0000-0000-000000000000}'<----------------------->SELECT * FROM tCompanyInfo WHERE CompanyID = '00000000-0000-0000-0000-000000000005'<----------------------->SELECT PaymentOptionID, OptionName, SurchargeType, Surcharge, IsDefault FROM tCTRL_PaymentOptions WHERE CompanyID = '00000000-0000-0000-0000-000000000005' AND IsActiveOnWeb = 1 Order By SortOrder<----------------------->SELECT tInventory.InventoryID, tInventory.Condition, ItemTitle, DescriptionHTML, DescriptionText, Weight, QtyInStock, WebFeaturedItem, DisplayOnWebSite, MinimumOrderQty, BarcodeID, tInventoryWebCategories.CategoryID As WebCategoryID, AlwaysInStock, IncRRP, RRP, Warranty, OutOfStockQTYRetail, dbo.tWebCategories.CategoryName AS CategoryTitle, ISNULL(A.QtyFrom, 0) AS MinQTY, ISNULL(B.QtyTo, 0) AS MaxQTY, ISNULL(AA.Price,0) AS MinPrice, PostageCostMethodDom, PostageCostMethodInt, ApplyFPRange, ApplyWSFPRange, tInventoryWebData.WebTitle, tInventoryWebData.DisableCheckout, ISNULL(AA.VariationKeyID, '{00000000-0000-0000-0000-000000000000}') AS VariationID, tInventory.InventoryType, tInventoryWebData.MetaTitle, tInventoryWebData.MetaKeywords, tInventoryWebData.MetaDescription, tInventoryWebData.URLKey, tInventoryWebData.HtmlH1, tInventoryWebData.HtmlH2, tInventoryWebData.HtmlContent FROM tInventory INNER JOIN tInventoryWebData ON tInventory.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebData.CompanyID = '00000000-0000-0000-0000-000000000005' INNER JOIN tInventoryWebCategories on tInventory.InventoryID = tInventoryWebCategories.InventoryID AND tInventoryWebCategories.IsDefaultWebCategory = 1 AND tInventoryWebCategories.CompanyID = '00000000-0000-0000-0000-000000000005' LEFT JOIN tWebCategories ON tInventoryWebCategories.CategoryID = tWebCategories.CategoryID AND tWebCategories.CompanyID = tInventoryWebCategories.CompanyID LEFT JOIN tInventoryWebPrices A ON A.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyFrom ASC ) LEFT JOIN tInventoryWebPrices B ON B.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyTo DESC ) LEFT JOIN tInventoryWebPriceVariations AA ON A.InventoryID = AA.InventoryID AND A.PriceID = AA.PriceID AND AA.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = A.InventoryID ORDER BY price ASC) LEFT JOIN tInventoryWebPriceVariations BB ON B.InventoryID = BB.InventoryID AND B.PriceID = BB.PriceID AND BB.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = B.InventoryID ORDER BY price ASC) WHERE tInventory.InventoryID = '{792d0998-af2c-4aba-8682-90d0df0b7b54}' ORDER BY WebTitle<----------------------->SELECT tInventory.InventoryID, tInventory.Condition, ItemTitle, DescriptionHTML, DescriptionText, Weight, QtyInStock, WebFeaturedItem, DisplayOnWebSite, MinimumOrderQty, BarcodeID, tInventoryWebCategories.CategoryID As WebCategoryID, AlwaysInStock, IncRRP, RRP, Warranty, OutOfStockQTYRetail, dbo.tWebCategories.CategoryName AS CategoryTitle, ISNULL(A.QtyFrom, 0) AS MinQTY, ISNULL(B.QtyTo, 0) AS MaxQTY, ISNULL(AA.Price,0) AS MinPrice, PostageCostMethodDom, PostageCostMethodInt, ApplyFPRange, ApplyWSFPRange, tInventoryWebData.WebTitle, tInventoryWebData.DisableCheckout, ISNULL(AA.VariationKeyID, '{00000000-0000-0000-0000-000000000000}') AS VariationID, tInventory.InventoryType, tInventoryWebData.MetaTitle, tInventoryWebData.MetaKeywords, tInventoryWebData.MetaDescription, tInventoryWebData.URLKey, tInventoryWebData.HtmlH1, tInventoryWebData.HtmlH2, tInventoryWebData.HtmlContent FROM tInventory INNER JOIN tInventoryWebData ON tInventory.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebData.CompanyID = '00000000-0000-0000-0000-000000000005' INNER JOIN tInventoryWebCategories on tInventory.InventoryID = tInventoryWebCategories.InventoryID AND tInventoryWebCategories.IsDefaultWebCategory = 1 AND tInventoryWebCategories.CompanyID = '00000000-0000-0000-0000-000000000005' LEFT JOIN tWebCategories ON tInventoryWebCategories.CategoryID = tWebCategories.CategoryID AND tWebCategories.CompanyID = tInventoryWebCategories.CompanyID LEFT JOIN tInventoryWebPrices A ON A.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyFrom ASC ) LEFT JOIN tInventoryWebPrices B ON B.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyTo DESC ) LEFT JOIN tInventoryWebPriceVariations AA ON A.InventoryID = AA.InventoryID AND A.PriceID = AA.PriceID AND AA.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = A.InventoryID ORDER BY price ASC) LEFT JOIN tInventoryWebPriceVariations BB ON B.InventoryID = BB.InventoryID AND B.PriceID = BB.PriceID AND BB.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = B.InventoryID ORDER BY price ASC) WHERE tInventory.InventoryID = '{792d0998-af2c-4aba-8682-90d0df0b7b54}' ORDER BY WebTitle<----------------------->SELECT tInventory.InventoryID, tInventory.Condition, ItemTitle, DescriptionHTML, DescriptionText, Weight, QtyInStock, WebFeaturedItem, DisplayOnWebSite, MinimumOrderQty, BarcodeID, tInventoryWebCategories.CategoryID As WebCategoryID, AlwaysInStock, IncRRP, RRP, Warranty, OutOfStockQTYRetail, dbo.tWebCategories.CategoryName AS CategoryTitle, ISNULL(A.QtyFrom, 0) AS MinQTY, ISNULL(B.QtyTo, 0) AS MaxQTY, ISNULL(AA.Price,0) AS MinPrice, PostageCostMethodDom, PostageCostMethodInt, ApplyFPRange, ApplyWSFPRange, tInventoryWebData.WebTitle, tInventoryWebData.DisableCheckout, ISNULL(AA.VariationKeyID, '{00000000-0000-0000-0000-000000000000}') AS VariationID, tInventory.InventoryType, tInventoryWebData.MetaTitle, tInventoryWebData.MetaKeywords, tInventoryWebData.MetaDescription, tInventoryWebData.URLKey, tInventoryWebData.HtmlH1, tInventoryWebData.HtmlH2, tInventoryWebData.HtmlContent FROM tInventory INNER JOIN tInventoryWebData ON tInventory.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebData.CompanyID = '00000000-0000-0000-0000-000000000005' INNER JOIN tInventoryWebCategories on tInventory.InventoryID = tInventoryWebCategories.InventoryID AND tInventoryWebCategories.IsDefaultWebCategory = 1 AND tInventoryWebCategories.CompanyID = '00000000-0000-0000-0000-000000000005' LEFT JOIN tWebCategories ON tInventoryWebCategories.CategoryID = tWebCategories.CategoryID AND tWebCategories.CompanyID = tInventoryWebCategories.CompanyID LEFT JOIN tInventoryWebPrices A ON A.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyFrom ASC ) LEFT JOIN tInventoryWebPrices B ON B.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyTo DESC ) LEFT JOIN tInventoryWebPriceVariations AA ON A.InventoryID = AA.InventoryID AND A.PriceID = AA.PriceID AND AA.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = A.InventoryID ORDER BY price ASC) LEFT JOIN tInventoryWebPriceVariations BB ON B.InventoryID = BB.InventoryID AND B.PriceID = BB.PriceID AND BB.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = B.InventoryID ORDER BY price ASC) WHERE tInventory.InventoryID = '{792d0998-af2c-4aba-8682-90d0df0b7b54}' ORDER BY WebTitle<----------------------->SELECT tInventory.InventoryID, tInventory.Condition, ItemTitle, DescriptionHTML, DescriptionText, Weight, QtyInStock, WebFeaturedItem, DisplayOnWebSite, MinimumOrderQty, BarcodeID, tInventoryWebCategories.CategoryID As WebCategoryID, AlwaysInStock, IncRRP, RRP, Warranty, OutOfStockQTYRetail, dbo.tWebCategories.CategoryName AS CategoryTitle, ISNULL(A.QtyFrom, 0) AS MinQTY, ISNULL(B.QtyTo, 0) AS MaxQTY, ISNULL(AA.Price,0) AS MinPrice, PostageCostMethodDom, PostageCostMethodInt, ApplyFPRange, ApplyWSFPRange, tInventoryWebData.WebTitle, tInventoryWebData.DisableCheckout, ISNULL(AA.VariationKeyID, '{00000000-0000-0000-0000-000000000000}') AS VariationID, tInventory.InventoryType, tInventoryWebData.MetaTitle, tInventoryWebData.MetaKeywords, tInventoryWebData.MetaDescription, tInventoryWebData.URLKey, tInventoryWebData.HtmlH1, tInventoryWebData.HtmlH2, tInventoryWebData.HtmlContent FROM tInventory INNER JOIN tInventoryWebData ON tInventory.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebData.CompanyID = '00000000-0000-0000-0000-000000000005' INNER JOIN tInventoryWebCategories on tInventory.InventoryID = tInventoryWebCategories.InventoryID AND tInventoryWebCategories.IsDefaultWebCategory = 1 AND tInventoryWebCategories.CompanyID = '00000000-0000-0000-0000-000000000005' LEFT JOIN tWebCategories ON tInventoryWebCategories.CategoryID = tWebCategories.CategoryID AND tWebCategories.CompanyID = tInventoryWebCategories.CompanyID LEFT JOIN tInventoryWebPrices A ON A.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyFrom ASC ) LEFT JOIN tInventoryWebPrices B ON B.PriceID = ( SELECT Top 1 PriceID FROM tInventoryWebPrices WHERE tInventoryWebPrices.InventoryID = tInventoryWebData.InventoryID AND tInventoryWebPrices.CompanyID = tInventoryWebData.CompanyID AND tInventoryWebPrices.IsWholesale = 0 ORDER BY QtyTo DESC ) LEFT JOIN tInventoryWebPriceVariations AA ON A.InventoryID = AA.InventoryID AND A.PriceID = AA.PriceID AND AA.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = A.InventoryID ORDER BY price ASC) LEFT JOIN tInventoryWebPriceVariations BB ON B.InventoryID = BB.InventoryID AND B.PriceID = BB.PriceID AND BB.VariationKeyID = (Select Top 1 VariationKeyID from tInventoryWebPriceVariations where InventoryID = B.InventoryID ORDER BY price ASC) WHERE tInventory.InventoryID = '{792d0998-af2c-4aba-8682-90d0df0b7b54}' ORDER BY WebTitle<------------