Tristan Caron
05/17/2018, 2:25 PMselect count(distinct my_column) from my_table where my_other_column = true
I have started the fellowing, but I don't know I can achieve what I would like
MyTable.select {
MyTable.myOtherColumn.eq(true)
}.withDistinct().count()
Any ideas?MyTable
.slice(MyTable.myColumn.countDistinct())
.select {
MyTable.myOtherColumn.eq(true)
}.first()
.let {
it[MyTable.myColumn.countDistinct()]
}
`
tapac
05/17/2018, 3:40 PMfirst()[MyTable.myColumn.countDistinct()]
without let
MyTable.run {
slice(myColumn.countDistinct()).
select { myOtherColumn eq true }.
first()[myColumn.countDistinct()]
}
Tristan Caron
05/18/2018, 6:04 AM