开发者

MYSQL subqueries using LIKE and IN

I'm trying to put together a MYSQL query designed for an AJAX\PHP CMS, which goes a little like this:

SELECT table.info 
FROM table 
WHERE table.variable LI开发者_如何学运维KE '%refinedby%' IN 
(SELECT other valid subquery to select data from)

However, I keep tripping syntax errors near LIKE '%refinedby'IN (

If I use = rather than LIKE there's no problem, as the following:

SELECT table.info 
FROM table 
WHERE table.variable = 'refinedby' IN 
(SELECT other valid subquery to select data from)

Does anyone have any ideas where I can't preceed a subquery with a LIKE selector?

Thanks in advance!


You can't use in like that you have to specify what is going to BE in

SELECT table.info 
FROM table 
WHERE table.variable LIKE '%refinedby%' 
and table.variable IN (SELECT other valid subquery to select data from)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜