[SalesForce] SOQL query all tasks and events with opportunities and any connected campaigns

I'm fairly new to SOQL but I need to write a query that returns all activities (Events and Tasks) that are associated with an opportunity. In addition I'd like to get any campaigns that are influencing the opportunity.

Any help would be appreciated, thanks.

Best Answer

Select CampaignId, campaign.name, (Select Id From Tasks), (Select Id  From Events) From Opportunity  WHERE id =: oppid

You could quite easily get the SOQL from salesforce schema within eclipse.