This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Description
A simple query as follow works great:
await db
.select(lf.fn.distinct(table.id))
.from(table)
.orderBy(table.id, lf.Order.ASC)
.limit(10)
.exec();
or even by an string field:
await db
.select(lf.fn.distinct(table.id))
.from(table)
.orderBy(table.title, lf.Order.ASC)
.limit(10)
.exec();
But ordering by date doesn't work in my case:
await db
.select(lf.fn.distinct(table.id))
.from(table)
.orderBy(table.created, lf.Order.ASC)
.limit(10)
.exec();
By not working I mean it gives me a result that doesn't change if I modify the order to DESC or ASC. It just returns a static result as if the date created is zero or the same number for all rows. Checked manually and each row does in fact have a different value.
Removing the distinct function fixes the problem.
If you need any additional information, please ask.