Created
November 22, 2017 10:13
-
-
Save steepzero-old/067953ab3f5cd4299d237f6f3aaf549d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT uc.* , el.*, ib.* | |
FROM oc_iblock_element as el | |
LEFT JOIN oc_iblock as ib ON el.IBLOCK_ID=ib.ID | |
LEFT JOIN oc_iblock_user_checkout as uc ON uc.USER_ID='98' and uc.IBLOCK_ID=el.IBLOCK_ID | |
WHERE | |
IF( | |
( SELECT COUNT(uuc.ID) FROM oc_iblock_user_checkout as uuc WHERE uuc.USER_ID='98' AND uuc.IBLOCK_ID=el.IBLOCK_ID) | |
,el.DATE_CREATE > uc.DATE AND el.ACTIVE = 'Y', el.ACTIVE = 'Y') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment