I have a table
id mid userid remarks
1 2 8 7
2 2 8 6
3 2 8
for mysql Node.js developers especially
I was unable to get direct-value in mysql-driver for node.js i.e. when I run the following query
SELECT MAX(id) FROM Users
and I got the result as [RowDataPacket { MAX(id): 1 }]
I tried to retrieve the value from object console.log(MAX(id))
, but I couldn't
so I set an alias
i.e. maxid
SELECT MAX(id) as maxid FROM Users
and got it as [RowDataPacket { maxid: 1 }]
Which I can retrieve as console.log(maxid)