我有一个选择语句:
SELECT term.name FROM terms as TERM WHERE term.name LIKE ''
现在,我有一个表选项,其中有一个列 options_name,其值为 = trgovine_TERMID_lokacija
因此,例如,我需要编写 sql 语句,将选项表与术语连接起来,并使用当前 id 搜索列 options_name。
我试过这个:
SELECT term.id, term.name FROM terms as term JOIN options AS o ON (o.option_name = trgovine_term.id_lokacija) WHERE term.name LIKE ''
但它不起作用:(
更新:
我什至现在尝试过这个:
SELECT term.term_id, term.name FROM wp_terms as term INNER JOIN wp_options AS o ON o.option_name = 'trgovine_'+term.term_id+'_lokacija' WHERE term.name LIKE '%%adidas%%'