CDbCommand не удалось исполнить SQL-запрос: SQLSTATE[42000]: Syntax error or access violation: 1064 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 lft<= AND parent_id=1 ' at line 25. The SQL statement executed was: select a.url,, as file_name, as alt, gallery_photo.description from ( SELECT,, sitemap.url, max(gallery_photo.rank) as max_rank FROM excursions INNER JOIN sitemap ON (excursions.sitemap_id = INNER JOIN gallery ON (excursions.gallery_id = INNER JOIN gallery_photo ON ( = gallery_photo.gallery_id) WHERE IN (select id from (select rgt, lft from sitemap where id = ( select id from sitemap where rgt>= AND lft<= AND parent_id=1 )) a, sitemap where a.rgt>= sitemap.rgt and a.lft<= sitemap.lft and id != and type = 3) GROUP BY,, sitemap.url ORDER BY RAND() LIMIT 3 ) a, sitemap, gallery, gallery_photo where = and a.max_rank = gallery_photo.rank and = gallery_photo.gallery_id (/home/u611/

#0 /home/u611/ CDbCommand->queryInternal('fetchAll', Array, Array)
#1 /home/u611/ CDbCommand->queryAll()
#2 /home/u611/ ExcursionsController->getRandom3(NULL)
#3 /home/u611/ ExcursionsController->actionView()
#4 /home/u611/ CInlineAction->runWithParams(Array)
#5 /home/u611/ CController->runAction(Object(CInlineAction))
#6 /home/u611/ CController->runActionWithFilters(Object(CInlineAction), Array)
#7 /home/u611/ CController->run('view')
#8 /home/u611/ CWebApplication->runController('excursions/view')
#9 /home/u611/ CWebApplication->processRequest()
#10 /home/u611/ CApplication->run()
#11 {main}