【问题标题】:Find ID's not match a list查找 ID 与列表不匹配
【发布时间】:2022-12-03 16:33:50
【问题描述】:

I cannot say I am so experienced with SQL. Here is my question. A table TripEvent have millions of rows. It contains a column Bold_ID that is indexed and unique.

So I can have this query

select bold_id from TripEvent where bold_id in (354469477, 354469536, 354469500, 987359)

Result is

354469477
354469536
354469500

as those exists. But I want to reverse it. How can I get a list if id\'s that don\'t exists ? In this case it should return one row

987359

I cannot use NOT in query as that would return all rows in table not match my list.

    标签: sql sql-server sql-server-2012


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多