Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue in count() #202

Open
mromid opened this issue Mar 19, 2019 · 3 comments
Open

issue in count() #202

mromid opened this issue Mar 19, 2019 · 3 comments

Comments

@mromid
Copy link

mromid commented Mar 19, 2019

when i run this query every thing is ok :
$stmt = $db->table('call_history')
->select('id')
->where('caller_id', $operator_id)
->groupBy('user_id')
->get();
// result is 5 record
but
run this query :
$stmt = $db->table('call_history')
->select('id')
->where('caller_id', $operator_id)
->groupBy('user_id')
->count();
// result is number 30 (common record not grouped)

groupby not true work !

when i remove groupBy from my query every thing is ok

@eL-Prova
Copy link

@mromid Its hard to read what you are trying to say.
What do you expect? The 5 or the 30 records?
Have you tried to see the extracted sql? In this case what is your raw query output...

@catchem99
Copy link

catchem99 commented Aug 7, 2019

I think I got what he means,
Steps to reproduce:
Import this really simple table
OR
make one like:
purchase_id,purchase_code
1,abc
2,def

Then use QB::table('TABLENAME')->groupBy('purchase_code')->count(); //This will return 1
while if you use a standard query SELECT * FROM TABLENAME GROUP BY purchase_code //It should return 2

EDIT: tested on MySQL

@mtarlac
Copy link

mtarlac commented Aug 26, 2019

Same problem like #180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants