Help with Mysql Query - Subindex_string + group_concat |
(05-06-2021, 07:24 AM)php_rocs Wrote: @tektion, Ah right, thanks for pointing that out didn't pay attention since I was focused on the line causing the syntax issue . Well the problem is the substring_index syntax is not right : Code: CRITICAL - 2021-05-06 15:54:50 --> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', = 1 This is the output I get from this query ! I tried replacing it with Code: ->where(SUBSTRING_INDEX(GROUP_CONCAT('GROUP'),',', 1)) But then I get an invalid function error : Call to undefined function App\Commands\SUBSTRING_INDEX() In the meantime I realized after running the query in MySql that you can't use it as a subquery with where statement so I changed it around and this is what works when I run directly in my database : Code: SELECT SUBSTRING_INDEX(GROUP_CONCAT(id separator ','), ',', 5) So I need to convert this into valid codeigniter format . Tried this : Code: $MyModel->select(SUBSTRING_INDEX(GROUP_CONCAT('id separator ',''), ',', 5)) Which still returns the error : Call to undefined function App\Commands\SUBSTRING_INDEX() |
Messages In This Thread |
Help with Mysql Query - Subindex_string + group_concat - by tektion - 05-05-2021, 05:15 PM
RE: Help with Mysql Query - Subindex_string + group_concat - by InsiteFX - 05-05-2021, 08:54 PM
RE: Help with Mysql Query - Subindex_string + group_concat - by tektion - 05-06-2021, 06:52 AM
RE: Help with Mysql Query - Subindex_string + group_concat - by php_rocs - 05-06-2021, 07:24 AM
RE: Help with Mysql Query - Subindex_string + group_concat - by tektion - 05-06-2021, 08:49 AM
RE: Help with Mysql Query - Subindex_string + group_concat - by iRedds - 05-06-2021, 05:57 PM
RE: Help with Mysql Query - Subindex_string + group_concat - by tektion - 05-06-2021, 09:54 PM
RE: Help with Mysql Query - Subindex_string + group_concat - by php_rocs - 05-06-2021, 12:24 PM
RE: Help with Mysql Query - Subindex_string + group_concat - by tektion - 05-06-2021, 09:42 PM
RE: Help with Mysql Query - Subindex_string + group_concat - by php_rocs - 05-07-2021, 08:25 AM
|