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