2017-05-29 67 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,無論如何,上面應該可以工作。 –