pixie icon indicating copy to clipboard operation
pixie copied to clipboard

issue in count()

Open mromid opened this issue 6 years ago • 3 comments

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

mromid avatar Mar 19 '19 19:03 mromid

@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...

eL-Prova avatar Mar 19 '19 20:03 eL-Prova

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

catchem99 avatar Aug 07 '19 16:08 catchem99

Same problem like #180

mtarlac avatar Aug 26 '19 00:08 mtarlac