0

首先,这就是表格的样子:

Checkpoint
==========
trans_id
checkpoint_id

Checkpoint_Data
===============
checkpoint_id
data

trans_id不是唯一的checkpointcheckpoint_id是唯一的checkpoint以及checkpoint_dataCheckpoint_id链接checkpointcheckpoint_data

我想trans_idcheckpoint关联datacheckpoint_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%')

一个简单的 NOT LIKE 不起作用。

4

2 回答 2

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%')
于 2013-02-14T16:34:35.710 回答
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%')
                  )
于 2013-02-14T16:28:44.793 回答