I’m not sure if it’s possible but I’m trying to do an insert while selecting for a value to do a +1. The reason I’m doing this is because my column is auto increments, but the values are all over the places.
Here’s what I have so far and it won’t let me do the insert:
insert into channels set chanid=(select chanid from channels where parent=2
order by chanid desc limit 1)+1
Try using an alias in the sub-query. It did the trick for me.
Reference: http://bugs.mysql.com/bug.php?id=6980