Using cast function in WHERE clause
planetarydev opened this issue · 3 comments
planetarydev commented
i want to cast any column type while using it in
where.
E.g.
Select * from table1
Where cast(date) = '2019-09-01'
planetarydev commented
@umer-mehmood You can use the $anyExpr helper or the short-hand simply $.
But you need th write the cast helper at first.
sql.build({
$select: {
$from: 'people',
$where: {
$and: [
{ $: { $cast: '~~my_date_column', $eq: 10 } }
]
}
}
});I though it was not so intuitiv. baut it works. Did you have any idea to implement some other logic for this?
umer-mehmood commented
Yes, I have added a CAST helper and using the
planetarydev commented
Thanks!