SELECT ui_id+1 FROM deals WHERE user_id = 1 ORDER BY ui_id DESC LIMIT 1;
INSERT INTO `deals` (`id`, `ui_id`, `user_id`) VALUES (NULL, "5", "1")
mysql> CREATE TABLE sequence (id INT NOT NULL);
mysql> INSERT INTO sequence VALUES (0);
mysql> UPDATE sequence SET id=LAST_INSERT_ID(id+1);
mysql> SELECT LAST_INSERT_ID();