bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

[Bug] It breaks on using * as selected columns in count() #154

Closed antonioribeiro closed 10 years ago

antonioribeiro commented 10 years ago

Take this select as an example:

select id, (select count(*) from users where users.session_id = sessions.id) as total
from sessions
order by total desc

If you use * instead of my columns we get:

select count(*) from sessions
order by total desc

But there is no total column in that table, so we get an exception. And the same may happen with Group By in some database systems.

ktunkiewicz commented 10 years ago

Merged your pull request. Thanks.

antonioribeiro commented 10 years ago

Thank you!