#begin 1
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/eda'
				AND RELATIVE_PATH = '/s1/bitrix/menu/06f'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/eda', '/s1/bitrix/menu/06f', 'bitrix:menu');
SELECT * FROM `b_forum_user` LIMIT 0;
UPDATE b_forum_user SET LAST_VISIT=now()  WHERE USER_ID = 1;
UPDATE b_forum_stat SET `USER_ID` = 1, `IP_ADDRESS` = '10.0.70.52', `SHOW_NAME` = 'admin', `LAST_VISIT` = now(), `SITE_ID` = 's1', `FORUM_ID` = 0, `TOPIC_ID` = 0 WHERE PHPSESSID='o50tf3qfh12hfbbfcpis0npeb2';

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/eda'
				AND RELATIVE_PATH = '/s1/bitrix/menu/345'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/eda', '/s1/bitrix/menu/345', 'bitrix:menu');

			SELECT
				COUNT(ST.ID) as CNT
			FROM
				b_sticker ST
			WHERE
				((ST.PERSONAL='Y' AND ST.CREATED_BY=1) OR ST.PERSONAL='N')
 AND ST.CLOSED='N' AND ST.DELETED='N' AND ST.SITE_ID='s1'
 AND ST.PAGE_URL='/forum/rules/';
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
SELECT * FROM `b_forum_user` LIMIT 0;
UPDATE b_forum_user SET LAST_VISIT=now()  WHERE USER_ID = 1;
UPDATE b_forum_stat SET `USER_ID` = 1, `IP_ADDRESS` = '10.0.70.52', `SHOW_NAME` = 'admin', `LAST_VISIT` = now(), `SITE_ID` = 's1', `FORUM_ID` = 1, `TOPIC_ID` = 0 WHERE PHPSESSID='o50tf3qfh12hfbbfcpis0npeb2';

			SELECT BF.ID AS FORUM_ID , COUNT(FT_RENEW.ID) TCRENEW
			FROM b_forum BF
			LEFT JOIN b_forum_user_forum FUF ON (FUF.USER_ID = 1 AND FUF.FORUM_ID = BF.ID)
			LEFT JOIN b_forum_user_forum FUF_ALL ON (FUF_ALL.USER_ID =  1 AND FUF_ALL.FORUM_ID =  0)
			LEFT JOIN b_forum_topic FT_RENEW ON
				(
					BF.ID = FT_RENEW.FORUM_ID AND FT_RENEW.STATE != 'L' AND
					(FUF_ALL.LAST_VISIT IS NULL OR FT_RENEW.ABS_LAST_POST_DATE >  FUF_ALL.LAST_VISIT)
				)
			LEFT JOIN b_forum_user_topic FUT_RENEW ON (
					FUT_RENEW.FORUM_ID =  BF.ID AND FUT_RENEW.TOPIC_ID =  FT_RENEW.ID AND FUT_RENEW.USER_ID =  1)
			WHERE(
				(BF.ID IN (1 ,2))
				AND
				(
					FUT_RENEW.LAST_VISIT IS NULL
					AND
					(
						(FUF_ALL.LAST_VISIT IS NULL AND FUF.LAST_VISIT IS NULL)
						OR
						(
							FUF.LAST_VISIT IS NOT NULL
							AND
							(FUF.LAST_VISIT <  FT_RENEW.ABS_LAST_POST_DATE OR FUF.LAST_VISIT <  FT_RENEW.LAST_POST_DATE)
						)
						OR
						(
							FUF.LAST_VISIT IS NULL
							AND
							FUF_ALL.LAST_VISIT IS NOT NULL
							AND
							(
								(
									FUF_ALL.LAST_VISIT <  FT_RENEW.ABS_LAST_POST_DATE
									OR
									FUF_ALL.LAST_VISIT <  FT_RENEW.LAST_POST_DATE
								)
							)
						)
					)
				)
				OR (
					FUT_RENEW.LAST_VISIT IS NOT NULL
					AND
					(
						FUT_RENEW.LAST_VISIT <  FT_RENEW.ABS_LAST_POST_DATE
						OR
						FUT_RENEW.LAST_VISIT <  FT_RENEW.LAST_POST_DATE
					)
				)
			)
			GROUP BY BF.ID
		;
SELECT FST.*, FU.*, FSTAT.IP_ADDRESS, FSTAT.PHPSESSID, 
	DATE_FORMAT(FSTAT.LAST_VISIT, '%d.%m.%Y %H:%i:%s') AS LAST_VISIT, 
	FSTAT.FORUM_ID, FSTAT.TOPIC_ID, 
	U.LOGIN, U.NAME, U.SECOND_NAME, U.LAST_NAME, 
	FSTAT.SHOW_NAME
  FROM (  SELECT FSTAT.USER_ID, MAX(FSTAT.ID) FST_ID, COUNT(FSTAT.PHPSESSID) COUNT_USER  FROM b_forum_stat FSTAT LEFT JOIN b_user U ON (FSTAT.USER_ID=U.ID) WHERE 1=1  AND (FSTAT.SITE_ID = 's1') AND (FSTAT.USER_ID = 0 OR U.ACTIVE = 'Y') AND (FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - 600) <=  FSTAT.LAST_VISIT)  GROUP BY FSTAT.USER_ID) FST LEFT JOIN b_forum_stat FSTAT ON (FST.FST_ID = FSTAT.ID) LEFT JOIN b_forum_user FU ON (FST.USER_ID = FU.USER_ID) LEFT JOIN b_user U ON (FST.USER_ID = U.ID)  ORDER BY FSTAT.USER_ID DESC;
SELECT COUNT('x') as C FROM b_user;
SELECT COUNT(FU.ID) AS CNT FROM b_forum_user FU INNER JOIN b_user U ON (U.ID = FU.USER_ID) WHERE (U.ACTIVE = 'Y') ;
SELECT COUNT(FU.ID) AS CNT FROM b_forum_user FU INNER JOIN b_user U ON (U.ID = FU.USER_ID) WHERE (NUM_POSTS > 0) AND (U.ACTIVE = 'Y') ;
SELECT F_FORUM.*, F.FORUM_GROUP_ID, F.NAME, F.DESCRIPTION, F.SORT, F.ACTIVE,
				F.ALLOW_HTML, F.ALLOW_ANCHOR, F.ALLOW_BIU, F.ALLOW_IMG, F.ALLOW_VIDEO,
				F.ALLOW_LIST, F.ALLOW_QUOTE, F.ALLOW_CODE, F.ALLOW_FONT, F.ALLOW_SMILES,
				F.ALLOW_ALIGN, F.ALLOW_UPLOAD, F.ALLOW_UPLOAD_EXT, F.ALLOW_MOVE_TOPIC,
				F.ALLOW_NL2BR, F.ALLOW_TABLE,  F.ALLOW_TOPIC_TITLED, F.ALLOW_SIGNATURE,
				
				F.ASK_GUEST_EMAIL, F.USE_CAPTCHA, F.MODERATION, F.INDEXATION, F.DEDUPLICATION,
				F.ORDER_BY, F.ORDER_DIRECTION,
				'' as LID, '' as DIR,
				F.TOPICS, F.XML_ID,
				F.POSTS, F.LAST_POSTER_ID, F.LAST_POSTER_NAME,
				DATE_FORMAT(F.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE,
				F.LAST_MESSAGE_ID, FM.TOPIC_ID as TID, F.LAST_MESSAGE_ID as MID,
				F.POSTS_UNAPPROVED, F.ABS_LAST_POSTER_ID, F.ABS_LAST_POSTER_NAME,
				DATE_FORMAT(F.ABS_LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as ABS_LAST_POST_DATE,
				F.ABS_LAST_MESSAGE_ID, FM_ABS.TOPIC_ID as ABS_TID,
				F.EVENT1, F.EVENT2, F.EVENT3,
				FT.TITLE, FT.SOCNET_GROUP_ID, FT.OWNER_ID,
				TRIM(BOTH '-' FROM REPLACE(CONCAT_WS('-',FT.ID,FT.TITLE_SEO), '--', '-')) AS TITLE_SEO,
				FT.HTML AS TOPIC_HTML, FM.PARAM1, FM.PARAM2,
				FT_ABS.TITLE as ABS_TITLE, FT_ABS.SOCNET_GROUP_ID as ABS_SOCNET_GROUP_ID, FT_ABS.OWNER_ID as ABS_OWNER_ID,
				TRIM(BOTH '-' FROM REPLACE(CONCAT_WS('-',FT_ABS.ID,FT_ABS.TITLE_SEO), '--', '-')) AS ABS_TITLE_SEO,
				FT_ABS.HTML AS ABS_TOPIC_HTML, FM_ABS.PARAM1 as ABS_PARAM1, FM_ABS.PARAM2 as ABS_PARAM2,
				F.HTML
			FROM
			(
				SELECT F.ID , F2S.PATH2FORUM_MESSAGE
				FROM b_forum F
					 
					INNER JOIN b_forum2site F2S ON (F2S.FORUM_ID=F.ID)
				WHERE (1=1  AND ((F2S.SITE_ID = 's1')) AND ((F.ID IN (1, 2))) )
					
				GROUP BY F.ID,F2S.PATH2FORUM_MESSAGE
			) F_FORUM
			INNER JOIN b_forum F ON (F_FORUM.ID = F.ID)
			LEFT JOIN b_forum_group FG ON F.FORUM_GROUP_ID = FG.ID
			LEFT JOIN b_forum_message FM ON F.LAST_MESSAGE_ID = FM.ID
			LEFT JOIN b_forum_topic FT ON FM.TOPIC_ID = FT.ID
			LEFT JOIN b_forum_message FM_ABS ON F.ABS_LAST_MESSAGE_ID = FM_ABS.ID
			LEFT JOIN b_forum_topic FT_ABS ON FM_ABS.TOPIC_ID = FT_ABS.ID
			;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/6b3'
				AND RELATIVE_PATH = '/s1/bitrix/menu/06f'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/6b3', '/s1/bitrix/menu/06f', 'bitrix:menu');
SELECT * FROM `b_forum_user` LIMIT 0;
UPDATE b_forum_user SET LAST_VISIT=now()  WHERE USER_ID = 1;
UPDATE b_forum_stat SET `USER_ID` = 1, `IP_ADDRESS` = '10.0.70.52', `SHOW_NAME` = 'admin', `LAST_VISIT` = now(), `SITE_ID` = 's1', `FORUM_ID` = 0, `TOPIC_ID` = 0 WHERE PHPSESSID='o50tf3qfh12hfbbfcpis0npeb2';
SELECT F_FORUM.*, F.FORUM_GROUP_ID, F.NAME, F.DESCRIPTION, F.SORT, F.ACTIVE,
				F.ALLOW_HTML, F.ALLOW_ANCHOR, F.ALLOW_BIU, F.ALLOW_IMG, F.ALLOW_VIDEO,
				F.ALLOW_LIST, F.ALLOW_QUOTE, F.ALLOW_CODE, F.ALLOW_FONT, F.ALLOW_SMILES,
				F.ALLOW_ALIGN, F.ALLOW_UPLOAD, F.ALLOW_UPLOAD_EXT, F.ALLOW_MOVE_TOPIC,
				F.ALLOW_NL2BR, F.ALLOW_TABLE,  F.ALLOW_TOPIC_TITLED, F.ALLOW_SIGNATURE,
				'' as PATH2FORUM_MESSAGE,
				F.ASK_GUEST_EMAIL, F.USE_CAPTCHA, F.MODERATION, F.INDEXATION, F.DEDUPLICATION,
				F.ORDER_BY, F.ORDER_DIRECTION,
				'' as LID, '' as DIR,
				F.TOPICS, F.XML_ID,
				F.POSTS, F.LAST_POSTER_ID, F.LAST_POSTER_NAME,
				DATE_FORMAT(F.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE,
				F.LAST_MESSAGE_ID, FM.TOPIC_ID as TID, F.LAST_MESSAGE_ID as MID,
				F.POSTS_UNAPPROVED, F.ABS_LAST_POSTER_ID, F.ABS_LAST_POSTER_NAME,
				DATE_FORMAT(F.ABS_LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as ABS_LAST_POST_DATE,
				F.ABS_LAST_MESSAGE_ID, FM_ABS.TOPIC_ID as ABS_TID,
				F.EVENT1, F.EVENT2, F.EVENT3,
				FT.TITLE, FT.SOCNET_GROUP_ID, FT.OWNER_ID,
				TRIM(BOTH '-' FROM REPLACE(CONCAT_WS('-',FT.ID,FT.TITLE_SEO), '--', '-')) AS TITLE_SEO,
				FT.HTML AS TOPIC_HTML, FM.PARAM1, FM.PARAM2,
				FT_ABS.TITLE as ABS_TITLE, FT_ABS.SOCNET_GROUP_ID as ABS_SOCNET_GROUP_ID, FT_ABS.OWNER_ID as ABS_OWNER_ID,
				TRIM(BOTH '-' FROM REPLACE(CONCAT_WS('-',FT_ABS.ID,FT_ABS.TITLE_SEO), '--', '-')) AS ABS_TITLE_SEO,
				FT_ABS.HTML AS ABS_TOPIC_HTML, FM_ABS.PARAM1 as ABS_PARAM1, FM_ABS.PARAM2 as ABS_PARAM2,
				F.HTML
			FROM
			(
				SELECT F.ID 
				FROM b_forum F
					
				WHERE (1=1 )
					
				GROUP BY F.ID
			) F_FORUM
			INNER JOIN b_forum F ON (F_FORUM.ID = F.ID)
			LEFT JOIN b_forum_group FG ON F.FORUM_GROUP_ID = FG.ID
			LEFT JOIN b_forum_message FM ON F.LAST_MESSAGE_ID = FM.ID
			LEFT JOIN b_forum_topic FT ON FM.TOPIC_ID = FT.ID
			LEFT JOIN b_forum_message FM_ABS ON F.ABS_LAST_MESSAGE_ID = FM_ABS.ID
			LEFT JOIN b_forum_topic FT_ABS ON FM_ABS.TOPIC_ID = FT_ABS.ID
			 ORDER BY  F.SORT ASC ;
SELECT COUNT('x') as CNT  FROM b_forum_user FU LEFT JOIN b_user U ON (FU.USER_ID = U.ID) WHERE 1 = 1 ;
SELECT FU.ID, U.ID as USER_ID, FU.SHOW_NAME, FU.DESCRIPTION, FU.IP_ADDRESS,
				FU.REAL_IP_ADDRESS, FU.AVATAR, FU.NUM_POSTS, FU.POINTS as NUM_POINTS,
				FU.INTERESTS, FU.SUBSC_GROUP_MESSAGE, FU.SUBSC_GET_MY_MESSAGE,
				FU.LAST_POST, FU.ALLOW_POST, FU.SIGNATURE, FU.RANK_ID,
				U.EMAIL, U.NAME, U.SECOND_NAME, U.LAST_NAME, U.LOGIN, U.PERSONAL_BIRTHDATE,
				DATE_FORMAT(FU.DATE_REG, '%d.%m.%Y') as DATE_REG,
				DATE_FORMAT(FU.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT,
				DATE_FORMAT(FU.LAST_VISIT, '%d.%m.%Y') as LAST_VISIT_SHORT,
				DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y') as DATE_REGISTER_SHORT,
				U.PERSONAL_ICQ, U.PERSONAL_WWW, U.PERSONAL_PROFESSION, U.DATE_REGISTER,
				U.PERSONAL_CITY, U.PERSONAL_COUNTRY, U.PERSONAL_PHOTO,
				U.PERSONAL_GENDER, FU.POINTS, FU.HIDE_FROM_ONLINE,
				DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') as PERSONAL_BIRTHDAY ,
CASE  WHEN (FU.USER_ID > 0  AND FU.SHOW_NAME = 'Y'  AND LENGTH(TRIM(CONCAT_WS('',U.NAME,' ',U.LAST_NAME))) > 0)  THEN TRIM(REPLACE(CONCAT_WS(' ',U.NAME,' ',U.LAST_NAME), '  ', ' ')) ELSE U.LOGIN  END AS SHOW_ABC FROM b_forum_user FU LEFT JOIN b_user U ON (FU.USER_ID = U.ID) WHERE 1 = 1  
 ORDER BY FU.NUM_POSTS DESC LIMIT 0, 20;
SELECT UG.GROUP_ID FROM b_user_group UG WHERE UG.USER_ID = 1 	AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= now())) 	AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= now())) ;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/6b3'
				AND RELATIVE_PATH = '/s1/bitrix/menu/345'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/6b3', '/s1/bitrix/menu/345', 'bitrix:menu');

			SELECT
				COUNT(ST.ID) as CNT
			FROM
				b_sticker ST
			WHERE
				((ST.PERSONAL='Y' AND ST.CREATED_BY=1) OR ST.PERSONAL='N')
 AND ST.CLOSED='N' AND ST.DELETED='N' AND ST.SITE_ID='s1'
 AND ST.PAGE_URL='/forum/users/';
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
SELECT * FROM `b_forum_user` LIMIT 0;
UPDATE b_forum_user SET LAST_VISIT=now()  WHERE USER_ID = 1;
UPDATE b_forum_stat SET `USER_ID` = 1, `IP_ADDRESS` = '10.0.70.52', `SHOW_NAME` = 'admin', `LAST_VISIT` = now(), `SITE_ID` = 's1', `FORUM_ID` = 0, `TOPIC_ID` = 0 WHERE PHPSESSID='o50tf3qfh12hfbbfcpis0npeb2';
SELECT COUNT('x') as CNT  FROM b_forum_user FU LEFT JOIN b_user U ON (FU.USER_ID = U.ID) WHERE 1 = 1 ;
SELECT FU.ID, U.ID as USER_ID, FU.SHOW_NAME, FU.DESCRIPTION, FU.IP_ADDRESS,
				FU.REAL_IP_ADDRESS, FU.AVATAR, FU.NUM_POSTS, FU.POINTS as NUM_POINTS,
				FU.INTERESTS, FU.SUBSC_GROUP_MESSAGE, FU.SUBSC_GET_MY_MESSAGE,
				FU.LAST_POST, FU.ALLOW_POST, FU.SIGNATURE, FU.RANK_ID,
				U.EMAIL, U.NAME, U.SECOND_NAME, U.LAST_NAME, U.LOGIN, U.PERSONAL_BIRTHDATE,
				DATE_FORMAT(FU.DATE_REG, '%d.%m.%Y') as DATE_REG,
				DATE_FORMAT(FU.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT,
				DATE_FORMAT(FU.LAST_VISIT, '%d.%m.%Y') as LAST_VISIT_SHORT,
				DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y') as DATE_REGISTER_SHORT,
				U.PERSONAL_ICQ, U.PERSONAL_WWW, U.PERSONAL_PROFESSION, U.DATE_REGISTER,
				U.PERSONAL_CITY, U.PERSONAL_COUNTRY, U.PERSONAL_PHOTO,
				U.PERSONAL_GENDER, FU.POINTS, FU.HIDE_FROM_ONLINE,
				DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') as PERSONAL_BIRTHDAY ,
CASE  WHEN (FU.USER_ID > 0  AND FU.SHOW_NAME = 'Y'  AND LENGTH(TRIM(CONCAT_WS('',U.NAME,' ',U.LAST_NAME))) > 0)  THEN TRIM(REPLACE(CONCAT_WS(' ',U.NAME,' ',U.LAST_NAME), '  ', ' ')) ELSE U.LOGIN  END AS SHOW_ABC FROM b_forum_user FU LEFT JOIN b_user U ON (FU.USER_ID = U.ID) WHERE 1 = 1  
 ORDER BY FU.NUM_POSTS DESC LIMIT 0, 20;
SELECT UG.GROUP_ID FROM b_user_group UG WHERE UG.USER_ID = 1 	AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= now())) 	AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= now())) ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/f25'
				AND RELATIVE_PATH = '/s1/bitrix/menu/06f'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/f25', '/s1/bitrix/menu/06f', 'bitrix:menu');
SELECT * FROM `b_forum_user` LIMIT 0;
UPDATE b_forum_user SET LAST_VISIT=now()  WHERE USER_ID = 1;
UPDATE b_forum_stat SET `USER_ID` = 1, `IP_ADDRESS` = '10.0.70.52', `SHOW_NAME` = 'admin', `LAST_VISIT` = now(), `SITE_ID` = 's1', `FORUM_ID` = 0, `TOPIC_ID` = 0 WHERE PHPSESSID='o50tf3qfh12hfbbfcpis0npeb2';
SELECT U.*, DATE_FORMAT(U.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X, IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL 120 SECOND), 'Y', 'N') IS_ONLINE, DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y %H:%i:%s') DATE_REGISTER, DATE_FORMAT(U.LAST_LOGIN, '%d.%m.%Y %H:%i:%s') LAST_LOGIN, DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') PERSONAL_BIRTHDAY
			
		
			FROM
				b_user U
				
				
			WHERE
				(1=1
					AND
					(
						U.ID='1'
					)
					)
			ORDER BY U.ID asc;
SELECT FU.ID, FU.USER_ID, FU.SHOW_NAME, FU.DESCRIPTION, FU.IP_ADDRESS,
					FU.REAL_IP_ADDRESS, FU.AVATAR, FU.NUM_POSTS, FU.POINTS as NUM_POINTS,
					FU.INTERESTS, FU.HIDE_FROM_ONLINE, FU.SUBSC_GROUP_MESSAGE, FU.SUBSC_GET_MY_MESSAGE,
					FU.LAST_POST, FU.ALLOW_POST, FU.SIGNATURE, FU.RANK_ID, FU.POINTS,
					DATE_FORMAT(FU.DATE_REG, '%d.%m.%Y') as DATE_REG,
					DATE_FORMAT(FU.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT
				FROM b_forum_user FU
				WHERE FU.USER_ID = 1;
SELECT F_FORUM.*, F.NAME, F.DESCRIPTION, F.ACTIVE, F.MODERATION, F.INDEXATION, F.DEDUPLICATION, F.ALLOW_MOVE_TOPIC, '' as LID,
				F.TOPICS, F.POSTS, F.LAST_POSTER_ID, F.LAST_POSTER_NAME,
				DATE_FORMAT(F.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE,
				F.LAST_MESSAGE_ID, F.LAST_MESSAGE_ID as MID,
				F.POSTS_UNAPPROVED, F.ABS_LAST_POSTER_ID, F.ABS_LAST_POSTER_NAME,
				DATE_FORMAT(F.ABS_LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as ABS_LAST_POST_DATE,
				F.ABS_LAST_MESSAGE_ID, F.SORT, F.ORDER_BY,
				F.ORDER_DIRECTION, F.ALLOW_HTML, F.ALLOW_ANCHOR, F.ALLOW_BIU,
				F.ALLOW_IMG, F.ALLOW_VIDEO, F.ALLOW_TABLE, F.ALLOW_LIST, F.ALLOW_QUOTE, F.ALLOW_CODE,
				F.ALLOW_ALIGN, F.ALLOW_FONT, F.ALLOW_SMILES, F.ALLOW_UPLOAD, F.EVENT1, F.EVENT2,
				F.EVENT3, F.ALLOW_NL2BR, '' as PATH2FORUM_MESSAGE, F.ALLOW_UPLOAD_EXT, F.ALLOW_TOPIC_TITLED,
				F.ALLOW_SIGNATURE,
				F.FORUM_GROUP_ID, F.ASK_GUEST_EMAIL, F.USE_CAPTCHA, F.XML_ID
			FROM
			(
				SELECT F.ID 
				FROM b_forum F
					, b_forum2site F2S
				WHERE (1=1  AND (F.ID = F2S.FORUM_ID AND (F2S.SITE_ID = 's1' )) AND ((F.ID IN (1, 2))) )
				GROUP BY F.ID
			) F_FORUM
			INNER JOIN b_forum F ON (F_FORUM.ID = F.ID)
			;
SELECT UG.GROUP_ID FROM b_user_group UG WHERE UG.USER_ID = 1 	AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= now())) 	AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= now())) ;

				SELECT ENTITY_TYPE_ID, ENTITY_ID, PREVIOUS_VALUE, CURRENT_VALUE, PREVIOUS_POSITION, CURRENT_POSITION
				FROM b_rating_results
				WHERE RATING_ID = '2'  AND ENTITY_ID IN (1)
			;

		SELECT FMM.*, FT.TITLE, FT.DESCRIPTION, FT.VIEWS, FT.LAST_POSTER_ID,
			TRIM(BOTH '-' FROM REPLACE(CONCAT_WS('-',FT.ID,FT.TITLE_SEO), '--', '-')) as TITLE_SEO,
			DATE_FORMAT(FT.START_DATE, '%d.%m.%Y %H:%i:%s') as START_DATE,
			FT.USER_START_NAME,	FT.USER_START_ID, FT.POSTS, FT.LAST_POSTER_NAME,
			FT.LAST_MESSAGE_ID, '' as IMAGE, '' as IMAGE_DESCR,
			FT.APPROVED, FT.STATE, FT.FORUM_ID, FT.ICON, FT.SORT, FT.HTML
		FROM
		(
			SELECT FM.TOPIC_ID, COUNT(FM.ID) AS COUNT_MESSAGE, MIN(FM.ID) AS FIRST_POST, MAX(FM.ID) AS LAST_POST
			FROM b_forum_message FM
			
			WHERE 1=1
			 AND (FM.AUTHOR_ID = (1)) AND (FM.FORUM_ID IN (1,2))
			GROUP BY FM.TOPIC_ID
		) FMM
		LEFT JOIN b_forum_topic FT ON (FT.ID = FMM.TOPIC_ID)
		ORDER BY FMM.LAST_POST DESC;
SELECT FM.ID, DATE_FORMAT(FM.POST_DATE, '%d.%m.%Y %H:%i:%s') AS POST_DATE FROM b_forum_message FM WHERE FM.ID=7 OR FM.ID=7;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/f25'
				AND RELATIVE_PATH = '/s1/bitrix/menu/345'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/f25', '/s1/bitrix/menu/345', 'bitrix:menu');

			SELECT
				COUNT(ST.ID) as CNT
			FROM
				b_sticker ST
			WHERE
				((ST.PERSONAL='Y' AND ST.CREATED_BY=1) OR ST.PERSONAL='N')
 AND ST.CLOSED='N' AND ST.DELETED='N' AND ST.SITE_ID='s1'
 AND ST.PAGE_URL='/forum/user/1/';
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  AND (L.LID='ru')  AND (L.ACTIVE='Y')  ORDER BY L.SORT ;
DELETE FROM b_admin_notify_lang WHERE NOTIFY_ID = 16;
DELETE FROM b_admin_notify WHERE ID = 16;
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/903'
				AND RELATIVE_PATH = '/s1/bitrix/menu/06f'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/903', '/s1/bitrix/menu/06f', 'bitrix:menu');

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/903'
				AND RELATIVE_PATH = '/s1/bitrix/menu/345'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/903', '/s1/bitrix/menu/345', 'bitrix:menu');

			SELECT
				COUNT(ST.ID) as CNT
			FROM
				b_sticker ST
			WHERE
				((ST.PERSONAL='Y' AND ST.CREATED_BY=1) OR ST.PERSONAL='N')
 AND ST.CLOSED='N' AND ST.DELETED='N' AND ST.SITE_ID='s1'
 AND ST.PAGE_URL='/events-calendar/';
SELECT AN.ID, AN.MODULE_ID, AN.TAG, AN.MESSAGE, AN.ENABLE_CLOSE, AN.PUBLIC_SECTION, ANL.MESSAGE as MESSAGE_LANG FROM b_admin_notify AN LEFT JOIN b_admin_notify_lang ANL ON (AN.ID = ANL.NOTIFY_ID AND ANL.LID = 'ru') WHERE (1=1
					AND
					(
						AN.PUBLIC_SECTION='N'
					)
					)  ORDER BY AN.ID DESC;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (6);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=6;

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Analytics\\CounterDataTable::submitData();',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(now(), INTERVAL 60 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=6;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT UNIX_TIMESTAMP(MIN(NEXT_EXEC))-UNIX_TIMESTAMP(NOW()) DATE_DIFF FROM b_agent WHERE ACTIVE='Y' ;
DELETE FROM b_admin_notify_lang WHERE NOTIFY_ID IN (SELECT ID FROM b_admin_notify WHERE TAG like '%PHOTOGALLERY_UPLOADER%');
DELETE FROM b_admin_notify WHERE TAG like '%PHOTOGALLERY_UPLOADER%';
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SELECT * FROM `b_admin_notify` LIMIT 0;
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SELECT  BE.ID as ID,BE.IBLOCK_ID as IBLOCK_ID,BE.ACTIVE as ACTIVE
			FROM 
			b_iblock B
			INNER JOIN b_lang L ON B.LID=L.LID
			INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID
			
		
			WHERE 1=1 
			AND (
			
				((((BE.IBLOCK_ID = '9'))))
				AND ((( BE.ACTIVE IS NULL OR NOT (BE.ACTIVE='Y'))))
			)
			AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)))
			
		 LIMIT 1;
SELECT AN.ID, AN.MODULE_ID, AN.TAG, AN.MESSAGE, AN.ENABLE_CLOSE, AN.PUBLIC_SECTION, ANL.MESSAGE as MESSAGE_LANG FROM b_admin_notify AN LEFT JOIN b_admin_notify_lang ANL ON (AN.ID = ANL.NOTIFY_ID AND ANL.LID = 'ru') WHERE (1=1
					AND
					(
						AN.PUBLIC_SECTION='N'
					)
					)  ORDER BY AN.ID DESC;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
DELETE FROM b_admin_notify_lang WHERE NOTIFY_ID IN (SELECT ID FROM b_admin_notify WHERE TAG like '%PHOTOGALLERY_UPLOADER%');
DELETE FROM b_admin_notify WHERE TAG like '%PHOTOGALLERY_UPLOADER%';
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SELECT * FROM `b_admin_notify` LIMIT 0;
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
SELECT L.*, BS.* FROM b_iblock_site BS, b_lang L WHERE L.LID=BS.SITE_ID AND BS.IBLOCK_ID=9;
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/cache/photogallery.~853832', '*');
SELECT A.ID, A.MODULE_ID, A.USER_ID, B.LOGIN, B.NAME as USER_NAME, B.LAST_NAME, A.SORT, A.NAME, A.ACTIVE, DATE_FORMAT(A.LAST_EXEC, '%d.%m.%Y %H:%i:%s') as LAST_EXEC, DATE_FORMAT(A.NEXT_EXEC, '%d.%m.%Y %H:%i:%s') as NEXT_EXEC, A.AGENT_INTERVAL, A.IS_PERIOD FROM b_agent A LEFT JOIN b_user B ON(A.USER_ID = B.ID) WHERE A.NAME LIKE '\\\\Bitrix\\\\Main\\\\Data\\\\CacheEngineFiles::delayedDelete(%' ORDER BY A.ID DESC;

			SELECT ID
			FROM b_agent
			WHERE NAME = '\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete();'
			AND USER_ID IS NULL;
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/managed_cache/MYSQL/agents.~53033', '*');
SELECT * FROM `b_agent` LIMIT 0;
INSERT INTO b_agent(`MODULE_ID`, `SORT`, `NAME`, `ACTIVE`, `NEXT_EXEC`, `AGENT_INTERVAL`, `IS_PERIOD`, `USER_ID`) VALUES('main', '100', '\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete();', 'Y', CURRENT_DATE, '1', 'Y',  NULL );
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/cache/s1/photogallery.~194981', '*');
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
SELECT L.*, BS.* FROM b_iblock_site BS, b_lang L WHERE L.LID=BS.SITE_ID AND BS.IBLOCK_ID=9;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";
SELECT L.*, BS.* FROM b_iblock_site BS, b_lang L WHERE L.LID=BS.SITE_ID AND BS.IBLOCK_ID=9;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT BP.*
			FROM b_iblock_property BP
		
				WHERE BP.ACTIVE = 'Y'
				AND BP.VERSION = 2
				AND BP.IBLOCK_ID = 9
			
				ORDER BY BP.SORT ASC
			;
SELECT  BE.ID as ID,BE.IBLOCK_ID as IBLOCK_ID
			FROM 
			b_iblock B
			INNER JOIN b_lang L ON B.LID=L.LID
			INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID
			
		
			WHERE 1=1 
			AND (
			
				((((BE.ID = '110'))))
				AND ((((B.ACTIVE='Y'))))
				AND ((((BE.IBLOCK_ID = '9'))))
			)
			AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)))
			
		;

			SELECT BP.*, BEP.ID as PROPERTY_VALUE_ID, BEP.VALUE, BEP.DESCRIPTION, BEPE.VALUE VALUE_ENUM, BEPE.XML_ID VALUE_XML_ID, BEPE.SORT VALUE_SORT
			FROM b_iblock B
				INNER JOIN b_iblock_property BP ON B.ID=BP.IBLOCK_ID
				LEFT JOIN b_iblock_element_property BEP ON (BP.ID = BEP.IBLOCK_PROPERTY_ID AND BEP.IBLOCK_ELEMENT_ID = 110)
				LEFT JOIN b_iblock_property_enum BEPE ON (BP.PROPERTY_TYPE = 'L' AND BEPE.ID=BEP.VALUE_ENUM AND BEPE.PROPERTY_ID=BP.ID)
			WHERE B.ID = 9
				AND BP.ACTIVE='Y'

			 ORDER BY  BP.SORT asc, BP.ID asc, BEPE.SORT asc, BEP.ID asc;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/c3f'
				AND RELATIVE_PATH = '/s1/bitrix/iblock.vote/cd2'
			;
UPDATE b_iblock_element SET 	TIMESTAMP_X = TIMESTAMP_X, 	SHOW_COUNTER_START = ifnull(SHOW_COUNTER_START, now()), 	SHOW_COUNTER =  ifnull(SHOW_COUNTER, 0) + 1 WHERE ID=110;
SELECT L.*, BS.* FROM b_iblock_site BS, b_lang L WHERE L.LID=BS.SITE_ID AND BS.IBLOCK_ID=9;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT BP.*
			FROM b_iblock_property BP
		
				WHERE BP.ACTIVE = 'Y'
				AND BP.VERSION = 2
				AND BP.IBLOCK_ID = 9
			
				ORDER BY BP.SORT ASC
			;
SELECT  BE.ID as ID,BE.IBLOCK_ID as IBLOCK_ID
			FROM 
			b_iblock B
			INNER JOIN b_lang L ON B.LID=L.LID
			INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID
			
		
			WHERE 1=1 
			AND (
			
				((((BE.ID = '111'))))
				AND ((((B.ACTIVE='Y'))))
				AND ((((BE.IBLOCK_ID = '9'))))
			)
			AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)))
			
		;

			SELECT BP.*, BEP.ID as PROPERTY_VALUE_ID, BEP.VALUE, BEP.DESCRIPTION, BEPE.VALUE VALUE_ENUM, BEPE.XML_ID VALUE_XML_ID, BEPE.SORT VALUE_SORT
			FROM b_iblock B
				INNER JOIN b_iblock_property BP ON B.ID=BP.IBLOCK_ID
				LEFT JOIN b_iblock_element_property BEP ON (BP.ID = BEP.IBLOCK_PROPERTY_ID AND BEP.IBLOCK_ELEMENT_ID = 111)
				LEFT JOIN b_iblock_property_enum BEPE ON (BP.PROPERTY_TYPE = 'L' AND BEPE.ID=BEP.VALUE_ENUM AND BEPE.PROPERTY_ID=BP.ID)
			WHERE B.ID = 9
				AND BP.ACTIVE='Y'

			 ORDER BY  BP.SORT asc, BP.ID asc, BEPE.SORT asc, BEP.ID asc;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/c3f'
				AND RELATIVE_PATH = '/s1/bitrix/iblock.vote/cd2'
			;
UPDATE b_iblock_element SET 	TIMESTAMP_X = TIMESTAMP_X, 	SHOW_COUNTER_START = ifnull(SHOW_COUNTER_START, now()), 	SHOW_COUNTER =  ifnull(SHOW_COUNTER, 0) + 1 WHERE ID=111;
SELECT L.*, BS.* FROM b_iblock_site BS, b_lang L WHERE L.LID=BS.SITE_ID AND BS.IBLOCK_ID=9;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (20);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=20;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

UPDATE b_cache_tag SET RELATIVE_PATH='3:1469352763' WHERE TAG='**';

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=20;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT UG.GROUP_ID FROM b_user_group UG WHERE UG.USER_ID = 1 	AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= now())) 	AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= now())) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT AN.ID, AN.MODULE_ID, AN.TAG, AN.MESSAGE, AN.ENABLE_CLOSE, AN.PUBLIC_SECTION, ANL.MESSAGE as MESSAGE_LANG FROM b_admin_notify AN LEFT JOIN b_admin_notify_lang ANL ON (AN.ID = ANL.NOTIFY_ID AND ANL.LID = 'ru') WHERE (1=1
					AND
					(
						AN.PUBLIC_SECTION='N'
					)
					)  ORDER BY AN.ID DESC;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (20);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=20;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

DELETE FROM b_cache_tag
				WHERE SITE_ID = '*'
				AND CACHE_SALT = '*'
				AND RELATIVE_PATH = '/bitrix/cache/photogallery.~853832';
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

UPDATE b_cache_tag SET RELATIVE_PATH='2:1469352770' WHERE TAG='**';

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=20;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT UG.GROUP_ID FROM b_user_group UG WHERE UG.USER_ID = 1 	AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= now())) 	AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= now())) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (20);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=20;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;


					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=20;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT UG.GROUP_ID FROM b_user_group UG WHERE UG.USER_ID = 1 	AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= now())) 	AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= now())) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (20);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=20;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

DELETE FROM b_cache_tag
				WHERE SITE_ID = '*'
				AND CACHE_SALT = '*'
				AND RELATIVE_PATH = '/bitrix/managed_cache/MYSQL/agents.~53033';
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

UPDATE b_cache_tag SET RELATIVE_PATH='1:1469352782' WHERE TAG='**';

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=20;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/f20'
				AND RELATIVE_PATH = '/s1/bitrix/menu/06f'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/f20', '/s1/bitrix/menu/06f', 'bitrix:menu');
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' 	AND B.GROUP_ID IN (1);
SELECT G.ID, G.NAME, G.SITE_ID FROM b_blog_group G WHERE G.ID = 1;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 3;
SELECT U.*, DATE_FORMAT(U.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X, IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL 120 SECOND), 'Y', 'N') IS_ONLINE, DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y %H:%i:%s') DATE_REGISTER, DATE_FORMAT(U.LAST_LOGIN, '%d.%m.%Y %H:%i:%s') LAST_LOGIN, DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') PERSONAL_BIRTHDAY
			
		
			FROM
				b_user U
				
				
			WHERE
				(1=1
					AND
					(
						U.ID='3'
					)
					)
			ORDER BY U.ID asc;
SELECT C.CATEGORY_ID as CATEGORY_ID, CC.NAME as NAME, COUNT( C.ID) as CNT FROM b_blog_post_category C 	LEFT JOIN b_blog_category CC ON (CC.ID = C.CATEGORY_ID) INNER JOIN b_blog_post P ON (P.ID = C.POST_ID) WHERE ((((C.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'P' )))) GROUP BY C.CATEGORY_ID, CC.NAME ORDER BY CC.NAME ASC ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  WHERE UG.USER_ID = 1 	AND UG.BLOG_ID = 0 ;
SELECT  DATE_FORMAT(P.DATE_PUBLISH, '%d.%m.%Y %H:%i:%s') as DATE_PUBLISH, P.ID as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'P' )))) ORDER BY P.DATE_PUBLISH ASC LIMIT 1;
SELECT DATE_FORMAT(P.DATE_PUBLISH, '%Y-%m-%d') as DATE_PUBLISH1, COUNT(P.ID) as CNT FROM b_blog_post P  WHERE P.BLOG_ID = 2 	AND P.DATE_PUBLISH >= '2016-07-01' 	AND P.DATE_PUBLISH < '2016-08-01' 	AND P.PUBLISH_STATUS = 'P' 	 GROUP BY DATE_PUBLISH1 ORDER BY DATE_PUBLISH1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' ;

					SELECT
						stags2.NAME
						,COUNT(DISTINCT stags2.SEARCH_CONTENT_ID) as CNT
						,MAX(sc.DATE_CHANGE) DC_TMP
						,DATE_FORMAT(MAX(sc.DATE_CHANGE), '%d.%m.%Y %H:%i:%s') as FULL_DATE_CHANGE
						,DATE_FORMAT(MAX(sc.DATE_CHANGE), '%d.%m.%Y') as DATE_CHANGE
					FROM b_search_tags stags2
						INNER JOIN b_search_content sc ON (stags2.SEARCH_CONTENT_ID=sc.ID)
						
						INNER JOIN b_search_content_site scsite ON (sc.ID=scsite.SEARCH_CONTENT_ID AND stags2.SITE_ID=scsite.SITE_ID)
						
					WHERE
						((1=1))
						AND (1=1) 
				AND (
					(
scsite.SITE_ID = 's1'
AND (
	(
		(sc.DATE_FROM IS NULL)
		OR sc.DATE_FROM <= '2016-07-24 12:33:02'
	)
	AND (
		(sc.DATE_TO IS NULL)
		OR sc.DATE_TO >= '2016-07-24 12:33:02'
	)
))
					AND(
				(
sc.MODULE_ID = 'blog'
AND sc.PARAM1 = 'POST'
AND sc.PARAM2 = '2'
				))
				)
					GROUP BY
						stags2.NAME
					 ORDER BY CNT DESC
				LIMIT 30;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/f20'
				AND RELATIVE_PATH = '/s1/bitrix/search.tags.cloud/f20'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/f20', '/s1/bitrix/search.tags.cloud/f20', 'bitrix:search.tags.cloud');
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='s1_blog_3')  WHERE UG.USER_ID = 1 ;
SELECT P.FAVORITE_SORT as FAVORITE_SORT, DATE_FORMAT(P.DATE_PUBLISH, '%d.%m.%Y %H:%i:%s') as DATE_PUBLISH, P.ID as ID, MAX('W') as PERMS, COUNT( P.ID) as CNT  FROM b_blog_post P 	  WHERE ((((P.PUBLISH_STATUS = 'P' )))) AND (((('W' > 'D' )))) AND ((((P.BLOG_ID = 2 )))) AND ((((P.FAVORITE_SORT > 0 )))) GROUP BY P.FAVORITE_SORT, P.DATE_PUBLISH, P.ID ORDER BY P.FAVORITE_SORT ASC, P.DATE_PUBLISH DESC LIMIT 25;
SELECT COUNT(DISTINCT P.ID) as CNT FROM b_blog_post P 	  WHERE ((((P.PUBLISH_STATUS = 'P' )))) AND (((('W' > 'D' )))) AND ((((P.BLOG_ID = 2 )))) AND ((((P.DATE_PUBLISH <= '2016-07-24 12:33:02')))) GROUP BY P.DATE_PUBLISH, P.ID ;
SELECT DATE_FORMAT(P.DATE_PUBLISH, '%d.%m.%Y %H:%i:%s') as DATE_PUBLISH, P.ID as ID, MAX('W') as PERMS, COUNT( P.ID) as CNT  FROM b_blog_post P 	  WHERE ((((P.PUBLISH_STATUS = 'P' )))) AND (((('W' > 'D' )))) AND ((((P.BLOG_ID = 2 )))) AND ((((P.DATE_PUBLISH <= '2016-07-24 12:33:02')))) GROUP BY P.DATE_PUBLISH, P.ID ORDER BY P.DATE_PUBLISH DESC, P.ID DESC  LIMIT 0, 27;
SELECT P.*, IF(P.DATE_PUBLISH <= NOW(), 'Y', 'N') as DATE_PUBLISHED, 	DATE_FORMAT(P.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(P.DATE_PUBLISH, '%d.%m.%Y %H:%i:%s') as DATE_PUBLISH FROM b_blog_post P WHERE P.ID = 3;
SELECT  G.ID as ID, G.FILE_ID as FILE_ID, G.POST_ID as POST_ID, G.BLOG_ID as BLOG_ID, G.USER_ID as USER_ID, G.TITLE as TITLE, DATE_FORMAT(G.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X, G.IMAGE_SIZE as IMAGE_SIZE FROM b_blog_image G 	 WHERE ((((G.POST_ID = 3 )))) AND ((((G.BLOG_ID = 2 )))) AND ((((G.IS_COMMENT = 'N' )))) ORDER BY G.ID ASC ;
SELECT G.* FROM b_blog_image G WHERE G.ID = 4;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 3;
SELECT U.*, DATE_FORMAT(U.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X, IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL 120 SECOND), 'Y', 'N') IS_ONLINE, DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y %H:%i:%s') DATE_REGISTER, DATE_FORMAT(U.LAST_LOGIN, '%d.%m.%Y %H:%i:%s') LAST_LOGIN, DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') PERSONAL_BIRTHDAY
			
		
			FROM
				b_user U
				
				
			WHERE
				(1=1
					AND
					(
						U.ID='3'
					)
					)
			ORDER BY U.ID asc;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 9;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 10;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 7;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 11;

			SELECT
				UF.ID
				,UF.ENTITY_ID
				,UF.FIELD_NAME
				,UF.USER_TYPE_ID
				,UF.XML_ID
				,UF.SORT
				,UF.MULTIPLE
				,UF.MANDATORY
				,UF.SHOW_FILTER
				,UF.SHOW_IN_LIST
				,UF.EDIT_IN_LIST
				,UF.IS_SEARCHABLE
				,UF.SETTINGS
				
					,UFL.EDIT_FORM_LABEL
					,UFL.LIST_COLUMN_LABEL
					,UFL.LIST_FILTER_LABEL
					,UFL.ERROR_MESSAGE
					,UFL.HELP_MESSAGE
				
			FROM
				b_user_field UF
				LEFT JOIN b_user_field_lang UFL on UFL.LANGUAGE_ID = 'ru' AND UFL.USER_FIELD_ID = UF.ID
			
WHERE UF.ENTITY_ID = 'BLOG_POST'
ORDER BY UF.SORT ASC, UF.ID ASC;
SELECT VALUE_ID, UF_BLOG_POST_DOC, UF_BLOG_POST_URL_PRV, UF_GRATITUDE FROM b_uts_blog_post WHERE VALUE_ID = 3;
SELECT P.*, IF(P.DATE_PUBLISH <= NOW(), 'Y', 'N') as DATE_PUBLISHED, 	DATE_FORMAT(P.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(P.DATE_PUBLISH, '%d.%m.%Y %H:%i:%s') as DATE_PUBLISH FROM b_blog_post P WHERE P.ID = 2;
SELECT  G.ID as ID, G.FILE_ID as FILE_ID, G.POST_ID as POST_ID, G.BLOG_ID as BLOG_ID, G.USER_ID as USER_ID, G.TITLE as TITLE, DATE_FORMAT(G.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X, G.IMAGE_SIZE as IMAGE_SIZE FROM b_blog_image G 	 WHERE ((((G.POST_ID = 2 )))) AND ((((G.BLOG_ID = 2 )))) AND ((((G.IS_COMMENT = 'N' )))) ORDER BY G.ID ASC ;
SELECT G.* FROM b_blog_image G WHERE G.ID = 3;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 3;
SELECT U.*, DATE_FORMAT(U.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X, IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL 120 SECOND), 'Y', 'N') IS_ONLINE, DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y %H:%i:%s') DATE_REGISTER, DATE_FORMAT(U.LAST_LOGIN, '%d.%m.%Y %H:%i:%s') LAST_LOGIN, DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') PERSONAL_BIRTHDAY
			
		
			FROM
				b_user U
				
				
			WHERE
				(1=1
					AND
					(
						U.ID='3'
					)
					)
			ORDER BY U.ID asc;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 5;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 6;
SELECT C.ID, C.BLOG_ID, C.NAME FROM b_blog_category C WHERE C.ID = 8;
SELECT VALUE_ID, UF_BLOG_POST_DOC, UF_BLOG_POST_URL_PRV, UF_GRATITUDE FROM b_uts_blog_post WHERE VALUE_ID = 2;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/f20'
				AND RELATIVE_PATH = '/s1/bitrix/menu/345'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/f20', '/s1/bitrix/menu/345', 'bitrix:menu');

			SELECT
				COUNT(ST.ID) as CNT
			FROM
				b_sticker ST
			WHERE
				((ST.PERSONAL='Y' AND ST.CREATED_BY=1) OR ST.PERSONAL='N')
 AND ST.CLOSED='N' AND ST.DELETED='N' AND ST.SITE_ID='s1'
 AND ST.PAGE_URL='/blogs/s1_blog_3/';
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (20);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=20;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=20;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' 	AND B.GROUP_ID IN (1);
SELECT G.ID, G.NAME, G.SITE_ID FROM b_blog_group G WHERE G.ID = 1;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  WHERE UG.USER_ID = 1 	AND UG.BLOG_ID = 0 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='s1_blog_3')  WHERE UG.USER_ID = 1 ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (20);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=20;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

DELETE FROM b_cache_tag
				WHERE SITE_ID = '*'
				AND CACHE_SALT = '*'
				AND RELATIVE_PATH = '/bitrix/cache/s1/photogallery.~194981';
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

UPDATE b_cache_tag SET RELATIVE_PATH='0:1469352793' WHERE TAG='**';
DELETE FROM b_agent WHERE ID=20;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' 	AND B.GROUP_ID IN (1);
SELECT G.ID, G.NAME, G.SITE_ID FROM b_blog_group G WHERE G.ID = 1;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  WHERE UG.USER_ID = 1 	AND UG.BLOG_ID = 0 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='s1_blog_3')  WHERE UG.USER_ID = 1 ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT UNIX_TIMESTAMP(MIN(NEXT_EXEC))-UNIX_TIMESTAMP(NOW()) DATE_DIFF FROM b_agent WHERE ACTIVE='Y' ;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' 	AND B.GROUP_ID IN (1);
SELECT G.ID, G.NAME, G.SITE_ID FROM b_blog_group G WHERE G.ID = 1;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  WHERE UG.USER_ID = 1 	AND UG.BLOG_ID = 0 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='s1_blog_3')  WHERE UG.USER_ID = 1 ;
SELECT  C.ID as ID, C.BLOG_ID as BLOG_ID, C.USER_ID as USER_ID FROM b_blog_user2blog C 	 WHERE ((((C.BLOG_ID = 2 )))) AND ((((C.USER_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.ID = 2;
SELECT U.*, DATE_FORMAT(U.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X, IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL 120 SECOND), 'Y', 'N') IS_ONLINE, DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y %H:%i:%s') DATE_REGISTER, DATE_FORMAT(U.LAST_LOGIN, '%d.%m.%Y %H:%i:%s') LAST_LOGIN, DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') PERSONAL_BIRTHDAY
			
		
			FROM
				b_user U
				
				
			WHERE
				(1=1
					AND
					(
						U.ID='1'
					)
					)
			ORDER BY U.ID asc;
SELECT * FROM `b_blog_user2blog` LIMIT 0;
INSERT INTO b_blog_user2blog(`USER_ID`, `BLOG_ID`) VALUES('1', '2');
SELECT U2B.ID, U2B.BLOG_ID, U2B.USER_ID FROM b_blog_user2blog U2B WHERE U2B.ID = 1;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT U.*, DATE_FORMAT(U.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X, IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL 120 SECOND), 'Y', 'N') IS_ONLINE, DATE_FORMAT(U.DATE_REGISTER, '%d.%m.%Y %H:%i:%s') DATE_REGISTER, DATE_FORMAT(U.LAST_LOGIN, '%d.%m.%Y %H:%i:%s') LAST_LOGIN, DATE_FORMAT(U.PERSONAL_BIRTHDAY, '%d.%m.%Y') PERSONAL_BIRTHDAY
			
		
			FROM
				b_user U
				
				
			WHERE
				(1=1
					AND
					(
						U.ID='3'
					)
					)
			ORDER BY U.ID asc;
SELECT * FROM `b_event` LIMIT 0;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT UNIX_TIMESTAMP(MIN(NEXT_EXEC))-UNIX_TIMESTAMP(NOW()) DATE_DIFF FROM b_agent WHERE ACTIVE='Y' ;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' 	AND B.GROUP_ID IN (1);
SELECT G.ID, G.NAME, G.SITE_ID FROM b_blog_group G WHERE G.ID = 1;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  WHERE UG.USER_ID = 1 	AND UG.BLOG_ID = 0 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='s1_blog_3')  WHERE UG.USER_ID = 1 ;
SELECT 'x' FROM b_event WHERE SUCCESS_EXEC='N' LIMIT 1;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_event', 0) as L;

				SELECT ID, C_FIELDS, EVENT_NAME, MESSAGE_ID, LID, DATE_FORMAT(DATE_INSERT, '%d.%m.%Y %H:%i:%s') as DATE_INSERT, DUPLICATE
				FROM b_event
				WHERE SUCCESS_EXEC='N'
				ORDER BY ID
				LIMIT 5;
SELECT 
	`main_mail_internal_event_attachment`.`FILE_ID` AS `FILE_ID`
FROM `b_event_attachment` `main_mail_internal_event_attachment` 

WHERE `main_mail_internal_event_attachment`.`EVENT_ID` = 1;
SELECT 
	`main_site`.`SERVER_NAME` AS `SERVER_NAME`,
	`main_site_culture`.`CHARSET` AS `CULTURE_CHARSET`
FROM `b_lang` `main_site` 
LEFT JOIN `b_culture` `main_site_culture` ON `main_site`.`CULTURE_ID` = `main_site_culture`.`ID`
WHERE (UPPER(`main_site`.`LID`) like upper('s1'));
SELECT 
	`main_mail_internal_event_message`.`ID` AS `ID`
FROM `b_event_message` `main_mail_internal_event_message` 
LEFT JOIN `b_event_message_site` `main_mail_internal_event_message_event_message_site` ON `main_mail_internal_event_message`.`ID` = `main_mail_internal_event_message_event_message_site`.`EVENT_MESSAGE_ID`
WHERE UPPER(`main_mail_internal_event_message`.`ACTIVE`) like upper('Y')
AND UPPER(`main_mail_internal_event_message`.`EVENT_NAME`) like upper('BLOG_YOU_TO_BLOG')
AND (UPPER(`main_mail_internal_event_message_event_message_site`.`SITE_ID`) like upper('s1'))
GROUP BY `main_mail_internal_event_message`.`ID`;
SELECT 
	`main_mail_internal_event_message`.`ID` AS `ID`,
	`main_mail_internal_event_message`.`TIMESTAMP_X` AS `TIMESTAMP_X`,
	`main_mail_internal_event_message`.`EVENT_NAME` AS `EVENT_NAME`,
	`main_mail_internal_event_message`.`LID` AS `LID`,
	`main_mail_internal_event_message`.`ACTIVE` AS `ACTIVE`,
	`main_mail_internal_event_message`.`EMAIL_FROM` AS `EMAIL_FROM`,
	`main_mail_internal_event_message`.`EMAIL_TO` AS `EMAIL_TO`,
	`main_mail_internal_event_message`.`SUBJECT` AS `SUBJECT`,
	`main_mail_internal_event_message`.`MESSAGE` AS `MESSAGE`,
	`main_mail_internal_event_message`.`MESSAGE_PHP` AS `MESSAGE_PHP`,
	`main_mail_internal_event_message`.`BODY_TYPE` AS `BODY_TYPE`,
	`main_mail_internal_event_message`.`BCC` AS `BCC`,
	`main_mail_internal_event_message`.`REPLY_TO` AS `REPLY_TO`,
	`main_mail_internal_event_message`.`CC` AS `CC`,
	`main_mail_internal_event_message`.`IN_REPLY_TO` AS `IN_REPLY_TO`,
	`main_mail_internal_event_message`.`PRIORITY` AS `PRIORITY`,
	`main_mail_internal_event_message`.`FIELD1_NAME` AS `FIELD1_NAME`,
	`main_mail_internal_event_message`.`FIELD1_VALUE` AS `FIELD1_VALUE`,
	`main_mail_internal_event_message`.`FIELD2_NAME` AS `FIELD2_NAME`,
	`main_mail_internal_event_message`.`FIELD2_VALUE` AS `FIELD2_VALUE`,
	`main_mail_internal_event_message`.`SITE_TEMPLATE_ID` AS `SITE_TEMPLATE_ID`,
	`main_mail_internal_event_message`.`ADDITIONAL_FIELD` AS `ADDITIONAL_FIELD`
FROM `b_event_message` `main_mail_internal_event_message` 

WHERE `main_mail_internal_event_message`.`ID` = 14;
SELECT 
	`main_mail_internal_event_message_attachment`.`FILE_ID` AS `FILE_ID`
FROM `b_event_message_attachment` `main_mail_internal_event_message_attachment` 

WHERE `main_mail_internal_event_message_attachment`.`EVENT_MESSAGE_ID` = 14;
SELECT 
	`main_mail_internal_event_message_site`.`SITE_ID` AS `SITE_ID`
FROM `b_event_message_site` `main_mail_internal_event_message_site` 

WHERE `main_mail_internal_event_message_site`.`EVENT_MESSAGE_ID` = 14
AND (UPPER(`main_mail_internal_event_message_site`.`SITE_ID`) like upper('s1'));
SELECT 
	`main_site`.`LID` AS `LID`,
	`main_site`.`SORT` AS `SORT`,
	`main_site`.`DEF` AS `DEF`,
	`main_site`.`ACTIVE` AS `ACTIVE`,
	`main_site`.`NAME` AS `NAME`,
	`main_site`.`DIR` AS `DIR`,
	`main_site`.`LANGUAGE_ID` AS `LANGUAGE_ID`,
	`main_site`.`DOC_ROOT` AS `DOC_ROOT`,
	`main_site`.`DOMAIN_LIMITED` AS `DOMAIN_LIMITED`,
	`main_site`.`SERVER_NAME` AS `SERVER_NAME`,
	`main_site`.`SITE_NAME` AS `SITE_NAME`,
	`main_site`.`EMAIL` AS `EMAIL`,
	`main_site`.`CULTURE_ID` AS `CULTURE_ID`
FROM `b_lang` `main_site` 

WHERE `main_site`.`LID` = 's1';
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT UNIX_TIMESTAMP(MIN(NEXT_EXEC))-UNIX_TIMESTAMP(NOW()) DATE_DIFF FROM b_agent WHERE ACTIVE='Y' ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT UNIX_TIMESTAMP(MIN(NEXT_EXEC))-UNIX_TIMESTAMP(NOW()) DATE_DIFF FROM b_agent WHERE ACTIVE='Y' ;
SELECT * FROM `b_event` LIMIT 0;
UPDATE b_event SET `DATE_EXEC` = '2016-07-24 12:33:27', `SUCCESS_EXEC` = 'Y' WHERE `ID` = '1';
SELECT 
	`main_mail_internal_event_attachment`.`FILE_ID` AS `FILE_ID`
FROM `b_event_attachment` `main_mail_internal_event_attachment` 

WHERE `main_mail_internal_event_attachment`.`EVENT_ID` = 2;
SELECT 
	`main_site`.`SERVER_NAME` AS `SERVER_NAME`,
	`main_site_culture`.`CHARSET` AS `CULTURE_CHARSET`
FROM `b_lang` `main_site` 
LEFT JOIN `b_culture` `main_site_culture` ON `main_site`.`CULTURE_ID` = `main_site_culture`.`ID`
WHERE (UPPER(`main_site`.`LID`) like upper('s1'));
SELECT 
	`main_mail_internal_event_message`.`ID` AS `ID`
FROM `b_event_message` `main_mail_internal_event_message` 
LEFT JOIN `b_event_message_site` `main_mail_internal_event_message_event_message_site` ON `main_mail_internal_event_message`.`ID` = `main_mail_internal_event_message_event_message_site`.`EVENT_MESSAGE_ID`
WHERE UPPER(`main_mail_internal_event_message`.`ACTIVE`) like upper('Y')
AND UPPER(`main_mail_internal_event_message`.`EVENT_NAME`) like upper('BLOG_USER_TO_YOUR_BLOG')
AND (UPPER(`main_mail_internal_event_message_event_message_site`.`SITE_ID`) like upper('s1'))
GROUP BY `main_mail_internal_event_message`.`ID`;
SELECT 
	`main_mail_internal_event_message`.`ID` AS `ID`,
	`main_mail_internal_event_message`.`TIMESTAMP_X` AS `TIMESTAMP_X`,
	`main_mail_internal_event_message`.`EVENT_NAME` AS `EVENT_NAME`,
	`main_mail_internal_event_message`.`LID` AS `LID`,
	`main_mail_internal_event_message`.`ACTIVE` AS `ACTIVE`,
	`main_mail_internal_event_message`.`EMAIL_FROM` AS `EMAIL_FROM`,
	`main_mail_internal_event_message`.`EMAIL_TO` AS `EMAIL_TO`,
	`main_mail_internal_event_message`.`SUBJECT` AS `SUBJECT`,
	`main_mail_internal_event_message`.`MESSAGE` AS `MESSAGE`,
	`main_mail_internal_event_message`.`MESSAGE_PHP` AS `MESSAGE_PHP`,
	`main_mail_internal_event_message`.`BODY_TYPE` AS `BODY_TYPE`,
	`main_mail_internal_event_message`.`BCC` AS `BCC`,
	`main_mail_internal_event_message`.`REPLY_TO` AS `REPLY_TO`,
	`main_mail_internal_event_message`.`CC` AS `CC`,
	`main_mail_internal_event_message`.`IN_REPLY_TO` AS `IN_REPLY_TO`,
	`main_mail_internal_event_message`.`PRIORITY` AS `PRIORITY`,
	`main_mail_internal_event_message`.`FIELD1_NAME` AS `FIELD1_NAME`,
	`main_mail_internal_event_message`.`FIELD1_VALUE` AS `FIELD1_VALUE`,
	`main_mail_internal_event_message`.`FIELD2_NAME` AS `FIELD2_NAME`,
	`main_mail_internal_event_message`.`FIELD2_VALUE` AS `FIELD2_VALUE`,
	`main_mail_internal_event_message`.`SITE_TEMPLATE_ID` AS `SITE_TEMPLATE_ID`,
	`main_mail_internal_event_message`.`ADDITIONAL_FIELD` AS `ADDITIONAL_FIELD`
FROM `b_event_message` `main_mail_internal_event_message` 

WHERE `main_mail_internal_event_message`.`ID` = 16;
SELECT 
	`main_mail_internal_event_message_attachment`.`FILE_ID` AS `FILE_ID`
FROM `b_event_message_attachment` `main_mail_internal_event_message_attachment` 

WHERE `main_mail_internal_event_message_attachment`.`EVENT_MESSAGE_ID` = 16;
SELECT 
	`main_mail_internal_event_message_site`.`SITE_ID` AS `SITE_ID`
FROM `b_event_message_site` `main_mail_internal_event_message_site` 

WHERE `main_mail_internal_event_message_site`.`EVENT_MESSAGE_ID` = 16
AND (UPPER(`main_mail_internal_event_message_site`.`SITE_ID`) like upper('s1'));
SELECT 
	`main_site`.`LID` AS `LID`,
	`main_site`.`SORT` AS `SORT`,
	`main_site`.`DEF` AS `DEF`,
	`main_site`.`ACTIVE` AS `ACTIVE`,
	`main_site`.`NAME` AS `NAME`,
	`main_site`.`DIR` AS `DIR`,
	`main_site`.`LANGUAGE_ID` AS `LANGUAGE_ID`,
	`main_site`.`DOC_ROOT` AS `DOC_ROOT`,
	`main_site`.`DOMAIN_LIMITED` AS `DOMAIN_LIMITED`,
	`main_site`.`SERVER_NAME` AS `SERVER_NAME`,
	`main_site`.`SITE_NAME` AS `SITE_NAME`,
	`main_site`.`EMAIL` AS `EMAIL`,
	`main_site`.`CULTURE_ID` AS `CULTURE_ID`
FROM `b_lang` `main_site` 

WHERE `main_site`.`LID` = 's1';
UPDATE b_event SET `DATE_EXEC` = '2016-07-24 12:33:37', `SUCCESS_EXEC` = 'Y' WHERE `ID` = '2';
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_event');

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;
SELECT 'x' FROM b_event WHERE SUCCESS_EXEC='N' LIMIT 1;
SELECT B.ID, B.USER_ID, B.ALIAS, B.DESCRIPTION, B.AVATAR, B.INTERESTS, 	B.ALLOW_POST, 	DATE_FORMAT(B.LAST_VISIT, '%d.%m.%Y %H:%i:%s') as LAST_VISIT, 	DATE_FORMAT(B.DATE_REG, '%d.%m.%Y %H:%i:%s') as DATE_REG FROM b_blog_user B WHERE B.USER_ID = 1;
SELECT * FROM `b_blog_user` LIMIT 0;
UPDATE b_blog_user SET 	LAST_VISIT=now()  WHERE ID = 1 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' 	AND B.GROUP_ID IN (1);
SELECT G.ID, G.NAME, G.SITE_ID FROM b_blog_group G WHERE G.ID = 1;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.OWNER_ID = 1 	AND B.GROUP_ID IN (1);
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'K' )))) ;
SELECT  COUNT(P.ID) as ID  FROM b_blog_post P 	  WHERE ((((P.BLOG_ID = 2 )))) AND ((((P.PUBLISH_STATUS = 'D' )))) AND ((((P.AUTHOR_ID = 1 )))) ;
SELECT COUNT( B.ID) as CNT  FROM b_blog_user B 	INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID) WHERE ((((B.USER_ID = 1 )))) AND ((((U2UG.BLOG_ID = 2 )))) ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  WHERE UG.USER_ID = 1 	AND UG.BLOG_ID = 0 ;
SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, 	B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, 	B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, 	DATE_FORMAT(B.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE, 	DATE_FORMAT(B.DATE_UPDATE, '%d.%m.%Y %H:%i:%s') as DATE_UPDATE, 	DATE_FORMAT(B.LAST_POST_DATE, '%d.%m.%Y %H:%i:%s') as LAST_POST_DATE FROM b_blog B WHERE B.URL = 's1_blog_3' ;
SELECT UG.ID, UG.USER_ID, UG.BLOG_ID, UG.USER_GROUP_ID FROM b_blog_user2user_group UG  INNER JOIN b_blog B ON (UG.BLOG_ID = B.ID AND B.URL='s1_blog_3')  WHERE UG.USER_ID = 1 ;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (6);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=6;

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Analytics\\CounterDataTable::submitData();',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(now(), INTERVAL 60 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=6;

			SELECT Q.*,
				DATE_FORMAT(Q.TIMESTAMP_X, '%d.%m.%Y') TIMESTAMP_X
			FROM b_vote_question Q
			WHERE (1=1
					AND
					(
						 (Q.ACTIVE = 'Y')
					)
					
					AND
					(
						Q.VOTE_ID = 1
					)
					)
			ORDER BY Q.C_SORT ASC;

			SELECT V.CHANNEL_ID, VQ.VOTE_ID, VA.*
			FROM b_vote_answer VA
				INNER JOIN b_vote_question VQ ON (VA.QUESTION_ID = VQ.ID)
				INNER JOIN b_vote V ON (VQ.VOTE_ID = V.ID)
			WHERE 1=1   AND ((VQ.VOTE_ID = 1)) AND ((VA.ACTIVE = 'Y')) AND ((VA.QUESTION_ID IN (1)))   ORDER BY VA.C_SORT ASC;
SELECT VEQ.QUESTION_ID, VEA.ANSWER_ID, COUNT(VEA.ID) as COUNTER, MIN(TIMESTAMPDIFF(SECOND, VE.DATE_VOTE, NOW())) AS LAST_VOTE FROM b_vote_event VE  INNER JOIN b_vote_event_question VEQ ON (VEQ.EVENT_ID = VE.ID)  INNER JOIN b_vote_event_answer VEA ON (VEA.EVENT_QUESTION_ID = VEQ.ID)  LEFT JOIN b_vote_user VU ON (VU.ID = VE.VOTE_USER_ID) WHERE 1=1  AND ((VE.VOTE_ID = 1)) AND ((VE.VALID = 'Y' ))  GROUP BY VEQ.QUESTION_ID, VEA.ANSWER_ID ORDER BY COUNTER DESC;
UPDATE b_vote_user SET `LAST_IP` = '10.0.70.52', `DATE_LAST` = now(), `STAT_GUEST_ID` = '0', `AUTH_USER_ID` = '1' WHERE (ID='1') AND (AUTH_USER_ID='1');
INSERT INTO b_vote_event(`VOTE_ID`, `VOTE_USER_ID`, `DATE_VOTE`, `STAT_SESSION_ID`, `IP`, `VALID`) VALUES (1, 1, now(), 0, '10.0.70.52', 'Y');
INSERT INTO b_vote_event_question(`EVENT_ID`, `QUESTION_ID`) VALUES (2, 1);
INSERT INTO b_vote_event_answer(`ANSWER_ID`, `EVENT_QUESTION_ID`) VALUES (1, 2);
UPDATE b_vote SET `COUNTER` = COUNTER+1 WHERE ID='1';
UPDATE b_vote_question SET `COUNTER` = COUNTER+1 WHERE ID in (1);
UPDATE b_vote_answer SET `COUNTER` = COUNTER+1 WHERE ID in (1);
UPDATE b_vote_user SET `DATE_LAST` = now(), `COUNTER` = COUNTER+1 WHERE ID='1';
SELECT * FROM b_cache_tag  WHERE TAG = 'vote_form_vote_1';
DELETE FROM b_cache_tag  WHERE TAG = 'vote_form_vote_1';

				DELETE FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/e25'
				AND RELATIVE_PATH = '/s1/bitrix/voting.current/ANKETA_s1/'
			;
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/cache/s1/bitrix/voting.current/ANKETA_s1.~619977', '*');
SELECT A.ID, A.MODULE_ID, A.USER_ID, B.LOGIN, B.NAME as USER_NAME, B.LAST_NAME, A.SORT, A.NAME, A.ACTIVE, DATE_FORMAT(A.LAST_EXEC, '%d.%m.%Y %H:%i:%s') as LAST_EXEC, DATE_FORMAT(A.NEXT_EXEC, '%d.%m.%Y %H:%i:%s') as NEXT_EXEC, A.AGENT_INTERVAL, A.IS_PERIOD FROM b_agent A LEFT JOIN b_user B ON(A.USER_ID = B.ID) WHERE A.NAME LIKE '\\\\Bitrix\\\\Main\\\\Data\\\\CacheEngineFiles::delayedDelete(%' ORDER BY A.ID DESC;

			SELECT ID
			FROM b_agent
			WHERE NAME = '\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete();'
			AND USER_ID IS NULL;
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/managed_cache/MYSQL/agents.~947835', '*');
SELECT * FROM `b_agent` LIMIT 0;
INSERT INTO b_agent(`MODULE_ID`, `SORT`, `NAME`, `ACTIVE`, `NEXT_EXEC`, `AGENT_INTERVAL`, `IS_PERIOD`, `USER_ID`) VALUES('main', '100', '\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete();', 'Y', CURRENT_DATE, '1', 'Y',  NULL );

				DELETE FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/e25'
				AND RELATIVE_PATH = '/s1/bitrix/voting.result/1'
			;
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/cache/s1/bitrix/voting.result/1.~485621', '*');

				DELETE FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/e25'
				AND RELATIVE_PATH = '/s1/bitrix/voting.form'
			;
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/cache/s1/bitrix/voting.form.~227422', '*');
INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG) VALUES ('*', '*', '/bitrix/managed_cache/MYSQL/b_vote.~855528', '*');

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;

			SELECT VV.*, C.TITLE as CHANNEL_TITLE, C.ACTIVE as CHANNEL_ACTIVE,
				C.HIDDEN as CHANNEL_HIDDEN, V.*,
				CASE WHEN (C.ACTIVE = 'Y' AND V.ACTIVE = 'Y' AND V.DATE_START <= NOW() AND NOW() <= V.DATE_END)
					THEN IF (C.VOTE_SINGLE != 'Y', 'green', 'yellow')
					ELSE 'red'
				END AS LAMP,
				DATE_FORMAT(V.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X,
				DATE_FORMAT(V.DATE_START, '%d.%m.%Y %H:%i:%s')	DATE_START,
				DATE_FORMAT(V.DATE_END, '%d.%m.%Y %H:%i:%s') DATE_END,
				UNIX_TIMESTAMP(V.DATE_END) - UNIX_TIMESTAMP(V.DATE_START) PERIOD
			FROM (
				SELECT V.ID, COUNT(Q.ID) QUESTIONS
				FROM b_vote V
					INNER JOIN b_vote_channel C ON (C.ID=V.CHANNEL_ID)
					LEFT JOIN b_vote_question Q ON (Q.VOTE_ID=V.ID)
					WHERE (1=1
					AND
					(
						( 
					(V.CHANNEL_ID='1' and V.CHANNEL_ID is not null)
					 )
					)
					
					AND
					(
						(V.ACTIVE='Y' and now()>=V.DATE_START and now()<=V.DATE_END)
					)
					)
					GROUP BY V.ID
			) VV
			INNER JOIN b_vote V ON (V.ID = VV.ID)
			INNER JOIN b_vote_channel C ON (C.ID = V.CHANNEL_ID) ORDER BY V.ID desc ;
SELECT MAX(V.ID) AS ACTIVE_VOTE_ID  FROM b_vote V  WHERE V.CHANNEL_ID=1 AND V.ACTIVE = 'Y' AND  NOW() >= V.DATE_START AND V.DATE_END >= NOW();

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/e25'
				AND RELATIVE_PATH = '/s1/bitrix/voting.current/ANKETA_s1/'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/e25', '/s1/bitrix/voting.current/ANKETA_s1/', 'vote_form_channel_1'),
('s1', '/e25', '/s1/bitrix/voting.current/ANKETA_s1/', 'vote_form_vote_1');

			SELECT V.*,
				C.TITLE as CHANNEL_TITLE,
				C.SYMBOLIC_NAME as CHANNEL_SYMBOLIC_NAME,
				C.C_SORT as CHANNEL_C_SORT,
				C.FIRST_SITE_ID as CHANNEL_FIRST_SITE_ID,
				C.ACTIVE as CHANNEL_ACTIVE,
				C.HIDDEN as CHANNEL_HIDDEN,
				C.TITLE as CHANNEL_TITLE,
				C.VOTE_SINGLE as CHANNEL_VOTE_SINGLE,
				C.USE_CAPTCHA as CHANNEL_USE_CAPTCHA,
				DATE_FORMAT(V.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') TIMESTAMP_X,
				DATE_FORMAT(V.DATE_START, '%d.%m.%Y %H:%i:%s') DATE_START,
				DATE_FORMAT(V.DATE_END, '%d.%m.%Y %H:%i:%s') DATE_END,
				CASE WHEN (C.ACTIVE = 'Y' AND V.ACTIVE = 'Y' AND V.DATE_START <= NOW() AND NOW() <= V.DATE_END)
					THEN IF (C.VOTE_SINGLE != 'Y', 'green', 'yellow')
					ELSE 'red'
				END AS LAMP
			FROM b_vote V
			INNER JOIN b_vote_channel C ON (V.CHANNEL_ID = C.ID)
			WHERE 1=1  AND ((V.ID = 1))  ORDER BY V.ID ASC;

			SELECT Q.*,
				DATE_FORMAT(Q.TIMESTAMP_X, '%d.%m.%Y') TIMESTAMP_X
			FROM b_vote_question Q
			WHERE (1=1
					AND
					(
						 (Q.ACTIVE = 'Y')
					)
					
					AND
					(
						Q.VOTE_ID = 1
					)
					)
			ORDER BY Q.C_SORT ASC;

			SELECT V.CHANNEL_ID, VQ.VOTE_ID, VA.*
			FROM b_vote_answer VA
				INNER JOIN b_vote_question VQ ON (VA.QUESTION_ID = VQ.ID)
				INNER JOIN b_vote V ON (VQ.VOTE_ID = V.ID)
			WHERE 1=1   AND ((VQ.VOTE_ID = 1)) AND ((VA.ACTIVE = 'Y')) AND ((VA.QUESTION_ID IN (1)))   ORDER BY VA.C_SORT ASC;
SELECT VEQ.QUESTION_ID, VEA.ANSWER_ID, COUNT(VEA.ID) as COUNTER, MIN(TIMESTAMPDIFF(SECOND, VE.DATE_VOTE, NOW())) AS LAST_VOTE FROM b_vote_event VE  INNER JOIN b_vote_event_question VEQ ON (VEQ.EVENT_ID = VE.ID)  INNER JOIN b_vote_event_answer VEA ON (VEA.EVENT_QUESTION_ID = VEQ.ID)  LEFT JOIN b_vote_user VU ON (VU.ID = VE.VOTE_USER_ID) WHERE 1=1  AND ((VE.VOTE_ID = 1)) AND ((VE.VALID = 'Y' ))  GROUP BY VEQ.QUESTION_ID, VEA.ANSWER_ID ORDER BY COUNTER DESC;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/e25'
				AND RELATIVE_PATH = '/s1/bitrix/voting.result/1'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/e25', '/s1/bitrix/voting.result/1', 'vote_form_channel_1'),
('s1', '/e25', '/s1/bitrix/voting.result/1', 'vote_form_vote_1'),
('s1', '/e25', '/s1/bitrix/voting.result/1', 'vote_form_question_1');
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (21);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=21;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

UPDATE b_cache_tag SET RELATIVE_PATH='5:1469352825' WHERE TAG='**';

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=21;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;

			SELECT Q.*,
				DATE_FORMAT(Q.TIMESTAMP_X, '%d.%m.%Y') TIMESTAMP_X
			FROM b_vote_question Q
			WHERE (1=1
					AND
					(
						 (Q.ACTIVE = 'Y')
					)
					
					AND
					(
						Q.VOTE_ID = 1
					)
					)
			ORDER BY Q.C_SORT ASC;

			SELECT V.CHANNEL_ID, VQ.VOTE_ID, VA.*
			FROM b_vote_answer VA
				INNER JOIN b_vote_question VQ ON (VA.QUESTION_ID = VQ.ID)
				INNER JOIN b_vote V ON (VQ.VOTE_ID = V.ID)
			WHERE 1=1   AND ((VQ.VOTE_ID = 1)) AND ((VA.ACTIVE = 'Y')) AND ((VA.QUESTION_ID IN (1)))   ORDER BY VA.C_SORT ASC;
SELECT VEQ.QUESTION_ID, VEA.ANSWER_ID, COUNT(VEA.ID) as COUNTER, MIN(TIMESTAMPDIFF(SECOND, VE.DATE_VOTE, NOW())) AS LAST_VOTE FROM b_vote_event VE  INNER JOIN b_vote_event_question VEQ ON (VEQ.EVENT_ID = VE.ID)  INNER JOIN b_vote_event_answer VEA ON (VEA.EVENT_QUESTION_ID = VEQ.ID)  LEFT JOIN b_vote_user VU ON (VU.ID = VE.VOTE_USER_ID) WHERE 1=1  AND ((VE.VOTE_ID = 1)) AND ((VE.VALID = 'Y' ))  GROUP BY VEQ.QUESTION_ID, VEA.ANSWER_ID ORDER BY COUNTER DESC;

				SELECT TAG
				FROM b_cache_tag
				WHERE SITE_ID = 's1'
				AND CACHE_SALT = '/e25'
				AND RELATIVE_PATH = '/s1/bitrix/voting.form'
			;

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/e25', '/s1/bitrix/voting.form', 'vote_form_channel_1');

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/e25', '/s1/bitrix/voting.form', 'vote_form_vote_1');

				INSERT IGNORE INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)
				VALUES
			('s1', '/e25', '/s1/bitrix/voting.form', 'vote_form_question_1');
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (21);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=21;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

DELETE FROM b_cache_tag
				WHERE SITE_ID = '*'
				AND CACHE_SALT = '*'
				AND RELATIVE_PATH = '/bitrix/cache/s1/bitrix/voting.current/ANKETA_s1.~619977';
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

UPDATE b_cache_tag SET RELATIVE_PATH='4:1469352827' WHERE TAG='**';

					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=21;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;

				SELECT DISTINCT
					B.*
					,B.XML_ID as EXTERNAL_ID
					,DATE_FORMAT(B.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X
					,L.DIR as LANG_DIR
					,L.SERVER_NAME
				FROM
					b_iblock B
					INNER JOIN b_lang L ON L.LID=B.LID
				WHERE 1 = 1
					
					 AND  ((((B.ACTIVE='Y'))))  AND  ((((B.ID = '2')))) 
			;
SET NAMES 'utf8';
SET collation_connection = "utf8_unicode_ci";

			SELECT 'x'
			FROM b_agent
			WHERE
				ACTIVE = 'Y'
				AND NEXT_EXEC <= now()
				AND (DATE_CHECK IS NULL OR DATE_CHECK <= now())
				
			LIMIT 1
		;
SELECT GET_LOCK('cff29ec0118154ee0dcf115d29478b29_agent', 0) as L;
SELECT ID, NAME, AGENT_INTERVAL, IS_PERIOD, MODULE_ID FROM b_agent WHERE ACTIVE='Y' 	AND NEXT_EXEC<=now() 	AND (DATE_CHECK IS NULL OR DATE_CHECK<=now())  ORDER BY RUNNING ASC, SORT desc;
UPDATE b_agent SET DATE_CHECK=DATE_ADD(IF(DATE_CHECK IS NULL, now(), DATE_CHECK), INTERVAL 600 SECOND) WHERE ID IN (21);
SELECT RELEASE_LOCK('cff29ec0118154ee0dcf115d29478b29_agent');
UPDATE b_agent SET RUNNING='Y' WHERE ID=21;
SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;

SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='**';
SELECT count(1) CNT from b_cache_tag WHERE TAG='*'
LIMIT 0, 1;


					UPDATE b_agent SET
						NAME='\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(1);',
						LAST_EXEC=now(),
						NEXT_EXEC=DATE_ADD(NEXT_EXEC, INTERVAL 1 SECOND),
						DATE_CHECK=NULL,
						RUNNING='N'
					WHERE ID=21;
DELETE FROM b_admin_notify_lang WHERE NOTIFY_ID IN (SELECT ID FROM b_admin_notify WHERE TAG like '%PHOTOGALLERY_UPLOADER%');
DELETE FROM b_admin_notify WHERE TAG like '%PHOTOGALLERY_UPLOADER%';
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SELECT * FROM `b_admin_notify` LIMIT 0;
SELECT L.*, L.LID as ID, L.LID as LANGUAGE_ID, 	C.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION FROM b_language L, b_culture C WHERE C.ID = L.CULTURE_ID  ORDER BY L.LID ;
SELECT DISTINCT BS.ID AS ID,
BS.ACTIVE AS ACTIVE,
BS.CREATED_BY AS CREATED_BY,
BS.IBLOCK_SECTION_ID AS IBLOCK_SECTION_ID,
BS.NAME AS NAME,
BS.PICTURE AS PICTURE,
BS.DESCRIPTION AS DESCRIPTION,
BS.DESCRIPTION_TYPE AS DESCRIPTION_TYPE,
BS.CODE AS CODE,
BS.SOCNET_GROUP_ID AS SOCNET_GROUP_ID,
DATE_FORMAT(BS.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') AS TIMESTAMP_X
				FROM b_iblock_section BS
					INNER JOIN b_iblock B ON BS.IBLOCK_ID = B.ID
					
				
				WHERE 1=1
				
				
				AND  ((((BS.IBLOCK_ID = '9')))) 
				AND  ((((BS.CREATED_BY = '1')))) 
				AND  (((BS.SOCNET_GROUP_ID IS  NULL))) 
				AND  (((BS.IBLOCK_SECTION_ID IS  NULL))) 
				AND  ((((B.ID = '9')))) 
				AND  ((((B.ACTIVE='Y')))) 
			
				ORDER BY  BS.TIMESTAMP_X desc ,  BS.ID desc ;

			SELECT BP.*
			FROM b_iblock_property BP
		
				WHERE BP.ACTIVE = 'Y'
				AND BP.VERSION = 2
				AND BP.IBLOCK_ID = 9
			
				ORDER BY BP.SORT ASC
			;
SELECT COUNT('x') as C 
			FROM 
			b_iblock B
			INNER JOIN b_lang L ON B.LID=L.LID
			INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID
			
		
			WHERE 1=1 
			AND (
			
				((((BE.IBLOCK_ID = '9'))))
				AND (
				
					((BE.IN_SECTIONS='N' OR EXISTS (
						SELECT BSE.IBLOCK_ELEMENT_ID
						FROM b_iblock_section_element BSE
						
						INNER JOIN b_iblock_section BS ON BSE.IBLOCK_SECTION_ID = BS.ID
						
						WHERE BSE.IBLOCK_ELEMENT_ID = BE.ID
						AND ((BS.ACTIVE = 'Y'))
						)))
				)
			)
			AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)))
			
		;
SELECT  BE.ID as ID,BE.CODE as CODE,BE.IBLOCK_ID as IBLOCK_ID,BE.IBLOCK_SECTION_ID as IBLOCK_SECTION_ID,BE.NAME as NAME,BE.ACTIVE as ACTIVE,BE.DETAIL_PICTURE as DETAIL_PICTURE,BE.PREVIEW_PICTURE as PREVIEW_PICTURE,BE.PREVIEW_TEXT as PREVIEW_TEXT,BE.DETAIL_TEXT as DETAIL_TEXT,DATE_FORMAT(BE.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE,BE.CREATED_BY as CREATED_BY,BE.SHOW_COUNTER as SHOW_COUNTER,BE.SORT as SORT,BE.TAGS as TAGS,DATE_FORMAT(BE.DATE_CREATE, '%Y.%m.%d') as CREATED_DATE,BE.DETAIL_TEXT_TYPE as DETAIL_TEXT_TYPE,BE.PREVIEW_TEXT_TYPE as PREVIEW_TEXT_TYPE
			FROM 
			b_iblock B
			INNER JOIN b_lang L ON B.LID=L.LID
			INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID
			
		
			WHERE 1=1 
			AND (
			
				((((BE.IBLOCK_ID = '9'))))
				AND (
				
					((BE.IN_SECTIONS='N' OR EXISTS (
						SELECT BSE.IBLOCK_ELEMENT_ID
						FROM b_iblock_section_element BSE
						
						INNER JOIN b_iblock_section BS ON BSE.IBLOCK_SECTION_ID = BS.ID
						
						WHERE BSE.IBLOCK_ELEMENT_ID = BE.ID
						AND ((BS.ACTIVE = 'Y'))
						)))
				)
			)
			AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)))
			
		 ORDER BY DATE_FORMAT(BE.DATE_CREATE, '%Y.%m.%d') desc ,BE.ID asc  LIMIT 0, 45;

			SELECT BP.*, BEP.ID as PROPERTY_VALUE_ID, BEP.VALUE, BEP.DESCRIPTION, BEPE.VALUE VALUE_ENUM, BEPE.XML_ID VALUE_XML_ID, BEPE.SORT VALUE_SORT
			FROM b_iblock B
				INNER JOIN b_iblock_property BP ON B.ID=BP.IBLOCK_ID
				LEFT JOIN b_iblock_element_property BEP ON (BP.ID = BEP.IBLOCK_PROPERTY_ID AND BEP.IBLOCK_ELEMENT_ID = 103)
				LEFT JOIN b_iblock_property_enum BEPE ON (BP.PROPERTY_TYPE = 'L' AND BEPE.ID=BEP.VALUE_ENUM AND BEPE.PROPERTY_ID=BP.ID)
			WHERE B.ID = 9
				AND BP.ACTIVE='Y'

			 ORDER BY  BP.SORT asc, BP.ID asc, BEPE.SORT asc, BEP.ID asc;
SELECT DISTINCT BS.ID AS ID,
BS.LEFT_MARGIN AS LEFT_MARGIN,
BS.RIGHT_MARGIN AS RIGHT_MARGIN,
BS.NAME AS NAME,
BS.ACTIVE AS ACTIVE
				FROM b_iblock_section BS
					INNER JOIN b_iblock B ON BS.IBLOCK_ID = B.ID
					
				
				WHERE 1=1
				
				
				AND  ((((BS.IBLOCK_ID = '9')))) 
				AND  ((((BS.ID = '96')))) 
				AND  ((((B.ID = '9')))) 
			;
SELECT DISTINCT 
				BS.*,
				B.LIST_PAGE_URL,
				B.SECTION_PAGE_URL,
				B.IBLOCK_TYPE_ID,
				B.CODE as IBLOCK_CODE,
				B.XML_ID as IBLOCK_EXTERNAL_ID,
				BS.XML_ID as EXTERNAL_ID,
				DATE_FORMAT(BS.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X,
				DATE_FORMAT(BS.DATE_CREATE, '%d.%m.%Y %H:%i:%s') as DATE_CREATE
			
				FROM b_iblock_section BS
					INNER JOIN b_iblock B ON BS.IBLOCK_ID = B.ID
					
				
				WHERE 1=1
				
				
				AND  ((((BS.IBLOCK_ID = '9')))) 
				AND  ((((BS.ID = '96')))) 
				AND  ((((B.ACTIVE='Y')))) 
				AND  ((((B.ID = '9')))) 
			;

			SELECT STRAIGHT_JOIN COUNT(DISTINCT BE.ID) as CNT
			FROM b_iblock_section BS
				INNER JOIN b_iblock_section BSTEMP ON (BSTEMP.IBLOCK_ID=BS.IBLOCK_ID
					AND BSTEMP.LEFT_MARGIN >= BS.LEFT_MARGIN
					AND BSTEMP.RIGHT_MARGIN <= BS.RIGHT_MARGIN)
				INNER JOIN b_iblock_section_element BSE ON BSE.IBLOCK_SECTION_ID=BSTEMP.ID
				INNER JOIN b_iblock_element BE ON BE.ID=BSE.IBLOCK_ELEMENT_ID AND BE.IBLOCK_ID=BS.IBLOCK_ID
			
			WHERE BS.ID=96
				AND ((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL )
				 OR BE.WF_NEW='Y' )
				
				;

					SELECT
						
				BS.*,
				B.LIST_PAGE_URL,
				B.SECTION_PAGE_URL,
				B.IBLOCK_TYPE_ID,
				B.CODE as IBLOCK_CODE,
				B.XML_ID as IBLOCK_EXTERNAL_ID,
				BS.XML_ID as EXTERNAL_ID
			
					FROM
						b_iblock_section BS
						INNER JOIN b_iblock B ON B.ID = BS.IBLOCK_ID
					WHERE BS.ID=96
						AND BS.IBLOCK_ID=9
				;

					SELECT
						
				BS.*,
				B.LIST_PAGE_URL,
				B.SECTION_PAGE_URL,
				B.IBLOCK_TYPE_ID,
				B.CODE as IBLOCK_CODE,
				B.XML_ID as IBLOCK_EXTERNAL_ID,
				BS.XML_ID as EXTERNAL_ID
			
					FROM
						b_iblock_section BS
						INNER JOIN b_iblock B ON B.ID = BS.IBLOCK_ID
					WHERE BS.ID=95
						AND BS.IBLOCK_ID=9;
#end
