joining multiple tables using laravel

Hi I am trying to do the following query using join in laravel.

select  advertisers.advertiserName,brands.brandName  
from vicinity_adman_dev.advertisers
     join vicinity_adman_dev.brands 
     join vicinity_adman_dev.campaigns
     join vicinity_adman_dev.banner_creatives

     on advertisers. advertiserId = brands.advertiserId
     banner_creatives.campaignId = campaigns.campaignId

What i DID so far:

  $campaigns =DB::table('brands')

 ->join('advertisers','brands.advertiserId' , '=','advertisers.advertiserId'               


getting error on second join "banner_creatives.campaignId" thanks in advance


You missed one of your joins. Just add it to the others

$campaigns = DB::table('brands')
               ->join('advertisers', 'brands.advertiserId', '=', 'advertisers.advertiserId')
               ->join('campaigns', 'banner_creatives.campaignId', '=', 'campaigns.campaignId')
               ->join('banner_creatives', 'banner_creatives.bannerCreativeId', '=', 'other_table.bannerCreativeId')

Need Your Help

Randomize content search web part results

search sharepoint-2013 web-parts

I am attempting to randomize search results from a content search web part on an o365 sharepoint farm.

How to pass a variable from View to Controller in ASP .NET

javascript html

I found similar questions to mine, but in all of those examples, the variable was part of the model. I am trying to pass a variable that is created in javascript, which is not part of the model.