mySQL Error
trace
Array
(
    [0] => Array
        (
            [file] => /var/www/html/local/classes/gaBase.php
            [line] => 17
            [function] => q
            [class] => gaBase
            [type] => ->
        )

    [1] => Array
        (
            [file] => /var/www/html/local/function.php
            [line] => 37
            [function] => __construct
            [class] => gaBase
            [type] => ->
        )

    [2] => Array
        (
            [file] => /var/www/html/local/classes/gaCatalog.php
            [line] => 380
            [function] => q
        )

    [3] => Array
        (
            [file] => /var/www/html/local/classes/gaCatalog.php
            [line] => 415
            [function] => getElementIdsByCatalogCode
            [class] => gaCatalog
            [type] => ::
        )

    [4] => Array
        (
            [file] => /var/www/html/local/classes/gaRender.php
            [line] => 180
            [function] => buildElementHTML
            [class] => gaCatalog
            [type] => ::
        )

    [5] => Array
        (
            [file] => /var/www/html/local/classes/gaRender.php
            [line] => 104
            [function] => getTemplate
            [class] => gaRender
            [type] => ::
        )

    [6] => Array
        (
            [file] => /var/www/html/local/classes/gaRender.php
            [line] => 116
            [function] => renderHCJ
            [class] => gaRender
            [type] => ::
        )

    [7] => Array
        (
            [file] => /var/www/html/local/classes/gaRouter.php
            [line] => 63
            [function] => renderHtml
            [class] => gaRender
            [type] => ::
        )

    [8] => Array
        (
            [file] => /var/www/html/local/classes/gaRouter.php
            [line] => 94
            [function] => checkRoute
            [class] => gaRouter
            [type] => ->
        )

    [9] => Array
        (
            [file] => /var/www/html/index.php
            [line] => 10
            [function] => __destruct
            [class] => gaRouter
            [type] => ->
        )

)
query
                SELECT se.IBLOCK_ELEMENT_ID AS EID, se.IBLOCK_SECTION_ID AS SID
                FROM b_iblock_section_element AS se
                    INNER JOIN b_iblock_element AS e ON e.ID = se.IBLOCK_ELEMENT_ID
                    LEFT JOIN b_iblock_section AS s ON s.LEFT_MARGIN >=  AND s.RIGHT_MARGIN <= 
                WHERE se.IBLOCK_SECTION_ID = s.ID AND s.IBLOCK_ID = 1 AND e.ACTIVE = "Y"
            ;
error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND s.RIGHT_MARGIN <= 
                WHERE se.IBLOCK_SECTION_ID = s.ID AND s.I' at line 4