CodeIgniter Forums
convert query to CI 3 query builder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: convert query to CI 3 query builder (/showthread.php?tid=83555)



convert query to CI 3 query builder - optic4predator1 - 10-04-2022

Code:
Hello team i hope you're doing well i have a query which i want to convert to CI 3 query builder

with t as  (
            select    regexp_substr(TAG_ID,'\d',1,level) as ID
                      ,count(*)                          as NUB_of_POSTS
            from      post 
            connect by ID = prior ID and level <= regexp_count(TAG_ID,'\d') and sys_guid() <> prior sys_guid()
            group by  regexp_substr(TAG_ID,'\d',1,level)
          )
select    NAME
          ,NUB_of_POSTS
from      t join tag using(ID)



RE: convert query to CI 3 query builder - InsiteFX - 10-06-2022

You probably will not get an answer to your question because most users have moved over to
CodeIgniter 4 so they do not have CodeIgniter 3 installed anymore.


RE: convert query to CI 3 query builder - kenjis - 10-06-2022

You can't.
Query Builder does not support WITH clause.

Why do you need to use Query Builder?


RE: convert query to CI 3 query builder - php_rocs - 10-06-2022

@optic4predator1 ,

You might want to try query binding instead (https://codeigniter.com/userguide3/database/queries.html?highlight=query%20binding#query-bindings). It may give you the results that you are looking for.