title: Join Laravel tables
body: <p>I have got three tables Kudos, Kudoscategories, and specialpost. I need to get the data from those tables and check the post id using a where condition.</p>
  
  <p>I have attached the database table screenshot here 
  <a href="https://i.stack.imgur.com/A0usM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A0usM.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/IQOwK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IQOwK.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/5CsaB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5CsaB.png" alt="enter image description here"></a>
  I already tried this, but it's not getting any result.</p>
  
  <pre><code>$results = DB::table('kudos')
  -&gt;select('kudos.description','kudoscategory.catname','kudoscategory.image','kudos.spid')
          -&gt;join('kudoscategory', 'kudoscategory.id', '=', 'kudos.categoryid')
          -&gt;where('kudos.spid', '=', $post_id)
          -&gt;first();
  
          return $results;
  </code></pre>
  
  <p>What I need to do is get the results using below where condition  <code>newsfeed_special_posts.main_post_id = kudos.spid</code> </p>