2017-05-29 72 views
-1

我有两个select查询。在特定行中选择一组数据集mySQL

查询1

select value, id from attributes where nodeId in (select id from nodes where imageGenerated = 0 and projectId = 49) 
and name = "basename"; 

形式这个查询即时得到的 '价值' 前的一些字符串值:BE3455444 kindof。我想从其中有那些“价值”包括在“内容”栏查询2行,下面是我的查询2

查询2

+0

请通过编辑问题为我们提供表格和列名称。 –

+0

@Shawn Mehan我更新了 –

回答

2

您可以使用JOINLIKE,例如

SELECT b.id, b.content 
FROM blocks b JOIN attributes a ON b.content LIKE CONCAT('%', a.value, '%') 
JOIN nodes n ON a.nodeId = n.id 
WHERE n.imageGenerated = 0 AND n.projectId = 49; 
+0

请问 \t 你能否再次检查我的问题,我已经用find int设置更新查询2如何继续查询。请咨询 –

+0

@hansisilva我现在看不到查询2,无论如何,上面应该可以工作。 –