I was wondering can you combine 2 child objects to a parent object.
SELECT SourceIp FROM LoginHistory WHERE UserId IN (SELECT Id FROM User)
SELECT City FROM LoginGeo WHERE CreatedbyId (SELECT Id from User)
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityLoginHistory
has a direct relationship to LoginGeo
, LoginGeoId
. Assuming what you're interested in is to obtain details of the geolocation for each specific LoginHistory
record, you can perform a relationship query:
SELECT SourceIp, LoginGeo.City FROM LoginHistory WHERE UserId IN (SELECT Id FROM User)
For details of the object fields and relationships, the SOAP API Reference for LoginHistory
is helpful.
You can do that like this:
SELECT Id, Name, (SELECT Id, Name FROM Opportunities),
(SELECT Id, Name FROM Contacts) FROM Account
That should allow you to get results with two inner queries.