首先,这就是表格的样子:
Checkpoint
==========
trans_id
checkpoint_id
Checkpoint_Data
===============
checkpoint_id
data
trans_id
并非checkpoint
唯一。 checkpoint_id
对checkpoint
以及checkpoint_data
都是唯一的。 Checkpoint_id
链接checkpoint
和checkpoint_data
我想从trans_id
中选择来自checkpoint
的关联data
不包含某些字符串的所有checkpoint_data
。
我基本上想要反驳这句话:
SELECT ch.trans_id
FROM checkpoint ch,
checkpoint_data chd
WHERE ch.checkpoint_id = chd.checkpoint_id
AND Upper(chd.data)LIKE Upper('%Example String%')
一个简单的不喜欢不起作用。
答案 0 :(得分:1)
或类似的东西......
SELECT ch.trans_id
FROM checkpoint ch
except
SELECT ch.trans_id
FROM checkpoint ch,
checkpoint_data chd
WHERE ch.checkpoint_id = chd.checkpoint_id
AND Upper(chd.data)LIKE Upper('%Example String%')
答案 1 :(得分:0)
这样的事情?
SELECT ch.trans_id
FROM checkpoint ch
WHERE not exists ( select * from checkpoint_data chd
where ch.checkpoint_id = chd.checkpoint_id
AND Upper(chd.data) LIKE Upper('%Example String%')
)