I want to convert the following MySQL queries into Codeigniter Active Record queries.
The following is MySQL:
Codignitor:
$ this-> Db- & gt; Range ($ perpage, $ page); $ Cavity = 'select brand_id' as item, where name (brand_id = b.brand_id)), (select number (*) from model where brand_id = b.brand_id) B 'as the Model C from the B range. $ Perpage 'Offset' $ Page. ' '; $ Query = $ this- & gt; Db- & gt; Query ($ query); $ Query = $ query- & gt; result (); Return $ query; Please help me in obtaining the above code for codeigniter active records.
There is query in active record
$ rows = $ this - & gt; Db- & gt; Select ('b.brand_id, b.name') - & gt; Select (select '(*) as item (*), select (*) (as the' brand_id = b.brand_id 'item), & gt; As Item (select (* count) - & gt; Select (Select from model (* *) where brand_id = b.brand_id modelc ', FALSE) - & gt; From ('Brand as B') - & gt; Range ($ perpage, $ page) - & gt; Received () - & gt; result ();
No comments:
Post a Comment