SELECT selling.ShopKey, tip.[Max-Parameters], tovar.[Max-Parameters]
FROM (selling LEFT JOIN (SELECT change_log.ShopKey, change_log.SeekKey, Max(change_log.Parameters) AS [Max-Parameters], Max(change_log.DatetimeEnd) AS [Max-DatetimeEnd] FROM change_log WHERE (((change_log.GuideKey)=592384))
GROUP BY change_log.ShopKey, change_log.SeekKey) AS tovar ON (selling.ResourceShopKey = tovar.SeekKey) AND (selling.ShopKey = tovar.ShopKey)) LEFT JOIN (SELECT change_log.ShopKey, change_log.SeekKey, Max(change_log.Parameters) AS [Max-Parameters], Max(change_log.DatetimeEnd) AS [Max-DatetimeEnd]
FROM change_log
WHERE (((change_log.GuideKey)=590848))
GROUP BY change_log.ShopKey, change_log.SeekKey) AS tip ON (selling.AccountKey = tip.SeekKey) AND (selling.ShopKey = tip.ShopKey);