1

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)
1

LoginHistory 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.

| improve this answer | |
0

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.

| improve this answer | |

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.