Welcome Guest, Not a member yet? Register   Sign In
Help with Mysql Query - Subindex_string + group_concat
#7

(05-06-2021, 08:49 AM)tektion Wrote:
Code:
$MyModel->select(SUBSTRING_INDEX(GROUP_CONCAT('id separator ',''), ',', 5))
                    ->orderBy('date', 'DESC')
                    ->groupBy('GROUP')
                    ->limit(2)
                    ->find();


Which still returns the error :  Call to undefined function App\Commands\SUBSTRING_INDEX()

You are using in the select method not a SQL function, but a php function (php thinks so). Therefore, you get an error.
Turn it into a string and you will be happy.
Reply


Messages In This Thread
RE: Help with Mysql Query - Subindex_string + group_concat - by iRedds - 05-06-2021, 05:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB