0
我正在爲這個查詢而努力。試圖選擇沒有附加/分配圖像的項目。選擇記錄到沒有附加圖像的地方
select distinct a.itm_id, a.itm_num, d.att_type from saitem as a
join saassignment as b on b.itm_id = a.itm_id
join sacatalogitem as c on c.itm_id = a.itm_id
join saattachment as d on d.att_id = b.att_id
where c.cat_id = '307'
and d.att_type not like '%application%'
and d.att_type not like '%text%'
and d.att_type not like '%url%'
and d.att_type not like '%image%'
order by a.itm_id ASC
我濾除了所有其他附件類型(應用程序,文本和網址)。如果在saitem表中沒有包含附件類型%image%,如何告訴sql選擇該記錄?現在我正在過濾掉所有%image%附件類型,因爲我不知道如何正確定義以獲取我正在尋找的內容...
編輯:我試圖選擇表中的所有記錄SAITEM,其中表SAATTACHMENT中沒有鏈接的「%image%」附件類型(列爲att_type)。我的問題是att_type列包含不同的類型,如應用程序,文本和URL,所以我不能只寫沒有圖像附件的地方。
樣本數據:
這完全不清楚您要問什麼。你能澄清你的問題嗎? – 2014-10-09 17:55:01
Porvide一些示例數據... – 2014-10-09 17:57:55
我添加了來自每個表的示例數據的圖片 – 2014-10-09 18:35:16