Exposed icon indicating copy to clipboard operation
Exposed copied to clipboard

Cannot use eq() with year() ?

Open bayang opened this issue 3 years ago • 0 comments

Hi I'm trying to select events where date.year() is 2022 for example, but I can't find how.

This works :

val yr = "2022"
query.andWhere { ReadingEventTable.modificationDate.year().between(yr, yr) }

This works :

val yr = "2022"
query.andWhere { ReadingEventTable.modificationDate.year().lessEq(yr) }

But obviously it does not only fetch 2022

This does not work and I can't find a way to do it :

val yr = "2022"
query.andWhere { ReadingEventTable.modificationDate.year().eq(yr) }

IDE says :

Type mismatch.Required:
Op<Boolean>
Found:
Unit

With ReadingEventTable like this :

object ReadingEventTable : UUIDTable("reading_event") {
    val creationDate = timestamp("creation_date")
    val modificationDate = timestamp("modification_date")
}

bayang avatar May 23 '22 06:05 bayang