I want to select column1
data where it's less than or equal with column2
. However, when I try using <=
I get an empty result, despite having data in column1
which is less than column2
.
My code:
router.get('/', function(req, res, next) {
db('items').select().where('column1', '<=', 'column2').then((notify)=>{
console.log(notify)
res.render('index', { title: 'Express', notify:notify })
})
})
and the result:
[]
which as you see is empty!
If I use greater or equal:
.where('column1', '>=', 'column2')
I get all the rows:
[ RowDataPacket {
column_id: 1,
column1: 99,
column2: 10, },
RowDataPacket {
column_id: 2,
column1: 10,
column2: 10, },
RowDataPacket {
column_id: 3,
column1: 29,
column2: 12,} ]
Why is this?