Hi, I have this table created.
CREATE TABLE `prueba` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fecha` datetime NOT NULL,
`usuario` varchar(45) DEFAULT NULL,
`notas` varchar(245) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
I’m trying to update the “notas” column when my id equals to the last row. This code updates all my rows, not just the last one, the “SELECT MAX()” it’s not working.
notas = event.source.parent.getComponent('detalle falla').text
update = system.db.runPrepUpdate("UPDATE prueba SET notas = ? WHERE id = (SELECT MAX(id))",[notas])