【发布时间】:2012-02-11 08:07:04
【问题描述】:
我想要这样的输出
ID Status
100 Viewed
103 Not Viewed
105 Viewed
这是我的 sql:
select id, status from status_table where ID in (100, 101,102,103,104,105);
它会显示上述结果,因为在状态表中其他 id 没有任何条目。 ID is foreign key of another table named as table_file table. It contains in another database. So I cannot join the table due to some performance issue. 所以我将文件 ID 作为逗号分隔值传递。但我想要这种结果如何在不使用任何循环的情况下创建它。
ID Status
100 Viewed
101 Not
102 Not
103 Viewed
104 Not
105 Viewed
有可能吗?请帮帮我。
【问题讨论】: