on 07-27-2023 10:30 PM
Hi.
I'm looking for an example on how to use groupBy using a field alias "as".
Didn't find yet or I did not understand how it work.
Any example pls ?
Hi I found out.
const oSelect = await db.run( SELECT.columns(["left(cpuDt,7) as mes", "COUNT(*) as count"]) .from(MY_TABLE) .where `cpuDt between ${dtFiltroInicial} and ${dtFiltroFinal}` .limit(1001) .groupBy("left(cpuDt,7)") .orderBy({'left(cpuDt,7)': 'asc'}) )You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.