Closed ghost closed 6 years ago
When you are using SUM()
, AVG()
or other aggregate functions with Medoo::raw object, there no need to using alias, because the tc, international, secondary and postsecondary will no longer present as table column.
You can just simply assign it as this:
[
"p.id(prov_id)[Int]",
"gr_tc [Int]" => Medoo::raw('SUM(<tc>)'),
"gr_int [Int]" => Medoo::raw('SUM(<international>)'),
"gr_se [Int]" => Medoo::raw('SUM(<secondary>)'),
"gr_ps [Int]" => Medoo::raw('SUM(<postsecondary>)'),
]
That makes sense... thx a lot, workin' perfectly !
Strangly enought... Renaming fields (using AS) doesnt work when using medoo::raw() in my query. I may forget something but i'm pretty sure about this !
example (work : all fields are in integer):
But this doesnt (tc/international/secondary/postsecondary remain string AND original name) :
It seems to not returning the proper type but always returning as string when using medoo:raw(). For now i must do a proper formatting with an additional forearch loop... annoying !