Using soql how can I get all the contacts from account via Opportunity object ? I have my button on Opportunity do i need subqueries for this scenario ?
You can try this code below:
SELECT Id, Name, (SELECT Id, Name FROM Contacts) FROM Account WHERE Id =: opp.AccountId
you can add other fields on the query if you want.
Hope that is helpful