I have these queries,

select ownerId from account
select firstname from user

How can I join them? OR How can I get the owner name from account table? Thanks in advance.

  • 2
    select owner.name from Account where ... – Jonathan Hersh Feb 8 '16 at 21:29

SELECT Owner.Name FROM Account WHERE ... Any time you've got a standard field which is a lookup, you can just remove 'Id' from the end and add '.Name' (or whatever other field you want). If you're dealing with a custom field (ending in __c), you can do the same with '__r.Name'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.