Welcome Guest, Not a member yet? Register   Sign In
Multiple joins
#1

[eluser]webnology[/eluser]
Hi all,

can't make these double joins work. I need to join 3 tables: atg_reviews, atg_bands, atg_gigs.

Code:
function getAllReviewsForConcert($concert_id) {
    
        $this->db->select('*');

        $this->db->from('atg_reviews');

        $this->db->join('atg_bands', 'atg_bands.band_id = atg_reviews.band_id');
        $this->db->join('atg_gigs', 'atg_gigs.gig_id = atg_reviews.gig_id');    
                              
        $this->db->order_by('date', 'desc');
        $this->db->where('gig_id', $concert_id);
        
        $Q = $this->db->get();

        return $Q;
    
    }

I get following error: Column 'gig_id' in where clause is ambiguous.

All help appreciated.

M
#2

[eluser]davidbehler[/eluser]
Try
Code:
$this->db->where('atg_reviews.gig_id', $concert_id, FALSE);
instead.
#3

[eluser]webnology[/eluser]
Nice. Thx man!




Theme © iAndrew 2016 - Forum software by © MyBB