我在SO中看过很多关于这个的帖子.但我无法得到答案.我想查询以检查表中是否存在特定行.如果它存在,它应该返回一个字符串 true并在那里停止搜索,如果不返回false.
Tom*_*zky 47
select
case when exists (select true from table_name where table_column=?)
then 'true'
else 'false'
end;
Run Code Online (Sandbox Code Playgroud)
但是最好只返回布尔值而不是字符串:
select exists (select true from table_name where table_column=?);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
32063 次 |
| 最近记录: |