Třídová akce

Kód:
1
Tělo:
Select
  PosAddressType,
  StorePosition_ID,
  StorePositionAddress
From
  LogStorePreferences A
  JOIN LogStorePreferences2 B ON A.ID = B.Parent_ID
Where
  B.PreferredObjectType = 0 and 
  B.StoreCard_ID = :StoreCard_ID and
  B.Strictly = 1
Union all
Select
  PosAddressType,
  StorePosition_ID,
  StorePositionAddress
From
  LogStorePreferences A
  JOIN LogStorePreferences2 B ON A.ID = B.Parent_ID
Where
  B.PreferredObjectType = 1 and 
  B.StoreCardCategory_ID = :StoreCardCategory_ID and
  B.Strictly = 1
Union all    
Select
  PosAddressType,
  StorePosition_ID,
  StorePositionAddress
From
  LogStorePreferences A
  JOIN LogStorePreferences2 B ON A.ID = B.Parent_ID
Where
  B.PreferredObjectType = 2 and
  B.StoreMenuItem_ID = :StoreMenuItem_ID and 
  B.Strictly = 1
Union all    
Select
  PosAddressType,
  StorePosition_ID,
  StorePositionAddress
From
  LogStorePreferences A
  JOIN LogStorePreferences2 B ON A.ID = B.Parent_ID
  LEFT JOIN Firms F ON B.Firm_ID = F.ID 
Where
  B.PreferredObjectType = 3 and
 (B.Firm_ID = :Firm_ID or 
  F.Firm_ID = :Firm_ID) and 
  B.Strictly = 1

Generated by ABRA Software a.s. 27.10.2021 16:35:19