sql - 如何在sql查询中使用exists函数?
问题描述
Select EXISTS (adm.document_id) as documentUploaded, name,customer_id as customerId,
adm.id,document.id as documentId from
document,application_document_mapping as adm where
document.deleted=false and document.id=adm.document_id and application_id=1;
上面的查询给出了一个语法错误。无法理解为什么?
解决方案
下面是一种方法
select t1.* from table document t1
where exists ( select 1 from application_document_mapping t2 where
t1.id=t2.document_id
and application_id=1)
推荐阅读
- spring - Spring Boot JSON 配置返回 null
- javascript - 如何将 code.gs 中的变量添加到 Audio src?
- c# - ASP.NET CORE 5.0 Identity 显示当前登录用户
- python - 在 pandas 中使用 for 循环创建新列
- php - MySQL检查大量数据
- python-3.x - LazyDocs - 生成的 *.md 文件不代表项目符号列表
- php - 调用未定义的方法 Illuminate\Database\Query\Builder::with() - Larvel
- selenium - 我们如何在 jmeter 中对 selenoid 运行 Selenium 测试?
- python - 为什么 Python 不喜欢与成员变量进行比较?
- sql - 使用 SQL 删除 Excel 工作表行