Проблемы с Where

Подскажите пожалуйста как правильно написать SQL запрос что бы у меня подхватывались значение из ТВ (множественный выбор), делаю условие
&where=`{"[[*id]]:IN":["category"]}`
но мое ТВ не подхватывается
<pre class="pdoResourcesLog">0.0001712: pdoTools loaded
0.0000460: xPDO query object created
0.0008309: Included list of tvs: <b>category, image</b>
0.0003321: leftJoined <i>modTemplateVarResource</i> as <b>TVcategory</b>
0.0002689: leftJoined <i>modTemplateVarResource</i> as <b>TVimage</b>
0.0006001: Added selection of <b>modResource</b>: <small>SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`</small>
0.0000131: Added selection of <b>modTemplateVarResource</b>: <small>IFNULL(`value`, '') AS `tv.category`</small>
0.0000088: Added selection of <b>modTemplateVarResource</b>: <small>IFNULL(`value`, '') AS `tv.image`</small>
0.0000479: Replaced TV conditions
0.0006652: Processed additional conditions
0.0011320: Added where condition: <b>31:IN(category), modResource.parent:IN(35,48,49), modResource.published=1, modResource.deleted=0, modResource.isfolder=0</b>
0.0000372: Replaced TV conditions
0.0001619: Sorted by <b>RAND()</b>, <b>DESC</b>
0.0000050: Limited to <b>3</b>, offset <b>0</b>
0.0003951: SQL prepared <small>"SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVcategory`.`value`, '') AS `tv.category`, IFNULL(`TVimage`.`value`, '') AS `tv.image` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVcategory` ON `TVcategory`.`contentid` = `modResource`.`id` AND `TVcategory`.`tmplvarid` = 6 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVimage` ON `TVimage`.`contentid` = `modResource`.`id` AND `TVimage`.`tmplvarid` = 1 WHERE  ( `modResource`.`31` IN ('category') AND `modResource`.`parent` IN (35,48,49) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 AND `modResource`.`isfolder` = 0 )  ORDER BY RAND() DESC LIMIT 3 "</small>
0.0005529: Could not process query, error #1054: Unknown column 'modResource.31' in 'where clause'
0.0046890: <b>Total time</b>
6 291 456: <b>Memory usage</b>
</pre>
Наверняка я что то делаю не так, но с SQL мало знаком и не хватает знаний поправить самому
Александр
17 июня 2017, 07:19
modx.pro
1 029
0

Комментарии: 1

Александр
17 июня 2017, 10:31
0
Решил свою задачу через
&tvFilters=`category==%[[*id]]%`
    Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
    1