Description
- Laravel Version: 5.3.*
- PHP Version: 7
- Database Driver & Version: MySql
Description:
Hello !
I try to get results form database and cunctruct pagination using query builder :
$profiles = DB::table('profiles')->select('profiles.*','profiles.id as profile_id');
$results = $profiles->paginate(8, ['id','name']);
In this case i get sql error like :
SQLSTATE[42000]: Syntax error or access violation: 1064 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 ' name
) as aggregate from profiles
' at line 1 (SQL: select count(id
, name
) as aggregate from profiles
)
It's clear that error apears because of : count(id
, name
)
I think should be generated count(id
) as aggregate, name
from profiles.
This is very disappointing becuase imagine that need to use having in sql, it's impossibile to use paginate for cases like that.