Welcome Guest, Not a member yet? Register   Sign In
Join problem with two fields named the same
#3

(This post was last modified: 03-15-2015, 08:08 AM by spjonez.)

Write the query yourself, it's reasons like this I never use CI's ActiveRecord methods.

Code:
$sql = "
    SELECT
        p.*,
        b.id AS brands_id, b.image_path AS brands_image_path
    FROM
        products p
        INNER JOIN brands b on p.brand_id = b.id
    WHERE
        p.brand_id = ?
";

$results = $this->db->query( $sql, array( $id ) )->results_array( );
Reply


Messages In This Thread
RE: Join problem with two fields named the same - by spjonez - 03-15-2015, 08:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB