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)

2 Answers 2

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.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .