简体   繁体   English

在Salesforce(SOQL)中加入案例和用户

[英]Join Case and User in Salesforce (SOQL)

I'm used to PostgreSQL but very new to SOQL and a bit confused about it. 我习惯了PostgreSQL,但对SOQL还是很陌生,对此有些困惑。 I would like to join rows from Case with rows from User based on User.Id. 我想将基于Case。的行与基于User.Id的User的行连接起来。

I've looked online and tried various solutions but nothing worked out. 我在网上查看并尝试了各种解决方案,但没有解决。

Does anyone know I could do that? 有人知道我能做到吗? What type of relationship binds Case and User? 哪种关系将案例和用户绑定在一起? Do I have to build a custom relationship between them? 我必须在它们之间建立自定义关系吗?

Thanks 谢谢

SOQL supports joins by following the relationship from the FK (using the relationship name), many of the schema explorer tools (SoqlX, Workbench, etc) will help you discover these and build/test SOQL queries. SOQL通过遵循来自FK的关系(使用关系名称)来支持联接 ,许多模式浏览器工具(SoqlX,Workbench等)将帮助您发现它们并构建/测试SOQL查询。 In this case you want something like 在这种情况下,您需要

select CaseNumber, LastModifiedBy.Name from Case Where ....

Try this, https://salesforce.stackexchange.com/questions/20572/soql-join-between-two-standard-objects 试试看, https://salesforce.stackexchange.com/questions/20572/soql-join-between-two-standard-objects

 Select CaseNumber, LastModifiedById, (Select name From User) 
 From Case WHERE day_only(convertTimezone(ClosedDate))=TODAY

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM