I'm running MySQl 3.23 and I'm trying to run a very simple command that basically finds the highest number in a column and then for all matching rows sets their card number to be <current highest> +1. The code looks like this:
#cardnumb is actually a string of the form SNxxxxx so set @high=xxxxx as a number
select @high:=convert( right( max( cardnumb ),5) , signed ) FROM Ops;
#for all matching crtieria set cardnumb to be
update Ops
set cardnumb = @high, @[EMAIL PROTECTED]
where newphoto =1 and tbprinted =1;
Without the ", @[EMAIL PROTECTED]" part in the script runs fine but sets everyone matching the criteria to @high, rather than increasing it. This is so incredibly simple but it just won't work for me and is not giving me any clue in the logs of on the website. Does anyone see my glaring error? I guess it should really be done by using another table but my current database is only 10k rows and grows very very slowly.
Thanks in advance,
P h i l l
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]