If you are trying to fetch data from one object to another object then and they should have parent child relationship between them, then you go for inner query.
You need the relationship name to perform inner SOQL query. For example, if you are going to perform a query to get Accounts along with their contacts then your query will be something like –
Select Id, Name,(Select Id, LastName from Contacts) from Account.