My SQL Query for Join

SELECT LoginIp.SourceIp, LoginHistory.SourceIp 
FROM ( LoginHistory INNER JOIN LoginIp ON LoginHistory.SourceIp = LoginIp.SourceIp)

To get Source Ip from LoginIp table and Login History table get using inner join. how can i do this in Sales force . I am using 40.0 partner wsdl sales force service reference .

I need exact query for do this operation. I am also tried this query also

SELECT LoginIp.SourceIp,( Select  LoginHistory.SourceIp  from LoginHistory)  from LoginIp

1 Answer 1


There is a distinction in Salesforce between simple data vales (such as string fields like SourceIp) and object relationships: you can only do joins across the latter. Worth studying e.g A Deeper look at SOQL and Relationship Queries on Force.com for a while to see what is and isn't possible.

From quick check of the data model, the LoginHistory and LoginIp objets do not have a direct relationship, though they are both related to User. You may have to do two queries to grab the fields you want.

You must log in to answer this question.

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