Welcome Guest, Not a member yet? Register   Sign In
convert value from routes/uri to string

(04-16-2019, 07:21 AM)dave friend Wrote: I don't see why you are using the sub-select. Here is how to do the above using Query Builder, but without the sub-select.

PHP Code:
   public function user_campaign($key$value)
       return $this->db
           ->join('campaigns''users_campaigns.id = campaigns.id''inner')

I think in basic queries it is required to select in sub-queries, am I correct?

I have used the logic above before but with basic queries that are required to use sub-select so that it gets erorr which is caused to clash in the ID column, that's why I rotate that logic.

the above method does produce the data that I want. but the method above is not a sub-query.
the concern is that in the future I have to use multiple sub-queries.

what if I faced a query like this (this is only for example):
PHP Code:
public function user_campaign($var1$var2$var3$var4 )
   return $this->db->query("
        SELECT *
        FROM (
            SELECT *
            FROM users
$var1 = '$var2'
        ) a
        INNER JOIN (
            SELECT *
            FROM campaigns
$var3 = '$var3'
        ) b
        ON a.id = b.id

I apologize in advance if I bother you

Messages In This Thread
convert value from routes/uri to string - by DELE - 04-13-2019, 01:42 AM
RE: convert value from routes/uri to string - by DELE - 04-16-2019, 08:40 AM

Theme © iAndrew 2016 - Forum software by © MyBB