我現在擁有的sql查詢如下。我嘗試了一些聯合查詢,但他們沒有工作。如何從兩個查詢中只返回一個查詢結果
Select file_path
from images
where image_id In (
Select image_id
from temp_images
where object_uid IN (
Select object_uid
from object_table
where object_status = 2 and object_place like "%some_keyword%"))`
Select object_uid, object_utitle
from object_table
where object_status = 2 and object_place like "%some_keyword%"`
這兩個查詢可能會返回很多行。我想這樣返回file_path和object_uid。
-Image_id | Object_uid | Object_utitle
-img1 | obj1 |標題1
-img2 | obj2 |標題2
-img2 | obj2 |標題3
有沒有辦法做到這一點?
有多少行是由這兩個查詢返回的?它是否每個都是一個? – Lokesh
您是否在查找包含來自每個或單獨記錄的數據的1條記錄? –
對不起,我的英語。這兩個查詢可能會返回許多行。但我想回到這樣。 Image_id | Object_uid | Object_utitle img1 | obj1 |標題1 img2 | obj2 |標題2 img2 | obj2 |標題3 – Casper009