Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.35 KB | None | 0 0
  1. SELECT DISTINCT
  2. Item_Table.IItemID AS ItemID AS customer_pk,
  3. Item_Table.SFullDescription AS FullDescription AS description,
  4. Category.ICatNodeID AS category,
  5.  
  6. Item_Table.SMainBarcode AS MainBarcode,
  7. Item_Table.BCoreRange AS CoreRange,
  8. Item_Table.SLabelDescription AS LabelDescription,
  9. Item_Table.CRetailValue AS RetailValue,
  10. price.ILocationID AS PriceTypeID,                                                          
  11. price.DTStart,
  12. price.DTFinish,
  13. price.BExpired AS Expired,
  14. price.CSellInc AS SellInc,
  15. price.DTLastModified
  16. stk.ILocationID AS LocationID,
  17. stk.DSoH AS SoH,
  18. stk.DHoldSoH AS HoldSoH,
  19. stk.IOnOrder AS OnOrder,
  20. stk.BStocked AS Stocked,
  21. stk.ISellMethodID AS SellMethodID,
  22. stk.DTLastModified,
  23. stk.ILastModifiedUserID AS LastModifiedUserID,
  24. stk.ILastModifiedRoleID AS LastModifiedRoleID
  25. location.SDescription AS LocDescription,
  26. location.SLocationCode AS LocationCode,
  27. loc2.ILocationID AS TargetStoreID,
  28. loc2.SLocationCode AS TargetStore,
  29. Brand.SDescription AS BrandDescription,
  30. Manufacturer.ISupplierID AS SupplierID,
  31. Manufacturer.SSupplierName AS SupplierName
  32. Merchandise.SDescription AS MerchandiseDescription,
  33. Range.SDescription AS RangeDescription,
  34. Range.SRangeCode AS RangeCode,
  35. SIZE.SDescription AS SizeDescription,
  36. SubRange.SDescription AS SubRangeDescription,
  37. Variety.SDescription AS VarietyDescription,
  38. FROM Item Item_Table
  39. LEFT JOIN Supplier Manufacturer ON Item_Table.IManufacturerID = Manufacturer.ISupplierID
  40. LEFT JOIN Def_Item_Brand Brand ON Item_Table.IBrandID = Brand.IBrandID
  41. LEFT JOIN Def_Item_Variety Variety ON Item_Table.IVarietyID = Variety.IVarietyID
  42. LEFT JOIN Def_Item_Size SIZE ON Item_Table.ISizeID = SIZE.ISizeID
  43. LEFT JOIN Def_Item_Range Range ON Item_Table.IRangeID = Range.IRangeID
  44. LEFT JOIN Def_Item_SubRange SubRange ON Item_Table.ISubRangeID = SubRange.ISubRangeID
  45. LEFT JOIN Def_Item_Merchandise Merchandise ON Item_Table.IMerchandiseID = Merchandise.IMerchandiseID
  46. LEFT JOIN Category_Relation Category ON Item_Table.ICatNodeID = Category.ICatNodeID
  47. LEFT JOIN price price ON Item_Table.IItemID = price.IItemID            
  48. LEFT JOIN Item_Stock stk ON Item_Table.IItemID = stk.IItemID          
  49. INNER JOIN location ON location.ILocationID = price.ILocationID
  50. INNER JOIN location loc2 ON loc2.ILocationID = stk.ILocationID
  51. WHERE price.BExpired != 'T'            
  52. ORDER BY price.ILocationID, price.IItemID, price.DTStart;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement