0

I'm used to PostgreSQL but very new to SOQL and a bit confused about it. I would like to join rows from Case with rows from User based on User.Id.

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

Roog
  • 1
  • 4
  • SELECT CaseNumber, LastModifiedById, User.name FROM Case WHERE day_only(convertTimezone(ClosedDate))=TODAY This last User Name column is the join I do not manage to make. I would like to show the name of the user that the LastModifiedById refers to. – Roog Mar 12 '15 at 19:07

2 Answers2

0

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. In this case you want something like

select CaseNumber, LastModifiedBy.Name from Case Where ....
superfell
  • 18,780
  • 4
  • 59
  • 81
  • Thank you very much for your answer. I did find this relationship meanwhile and the explorer tools you mention will help me understand the relationships I will have to use. – Roog Mar 13 '15 at 21:17
-1

Try this, 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
Community
  • 1
  • 1
user021205
  • 74
  • 1
  • 7