Tuesday, April 04, 2006

More SQL...

We wanted to change a field in every one of our defendants so that they had a "PrisonerID" based on their defendant id (which was the primary key) with a prefix of 'PR00'. We did the following (on MySQL 5):

mysql_prompt> update defendants set prisonerId=concat('PR00', defendantId);

No comments: