Here's what I'm trying to do - and failing!
I have two fields in the contact table - forenames and middlenames.
I'm trying to write a query to update the entire table as follows...
If the forenames field has only one name, do nothing - leave the middlenames field as it is
If the forenames field has more than one name (i.e. at least 2 words with a space between) I want to move the 2nd, 3rd, etc names to the middlenames field. In this scenario I doubt whether there's any data in the middlenames field, so it can be overwritten. The first name should stay on its own in the forenames field.
I can't get my head round this. Is there a way in SQL to do this in one command?
Thanks in advance for your replies.
I have two fields in the contact table - forenames and middlenames.
I'm trying to write a query to update the entire table as follows...
If the forenames field has only one name, do nothing - leave the middlenames field as it is
If the forenames field has more than one name (i.e. at least 2 words with a space between) I want to move the 2nd, 3rd, etc names to the middlenames field. In this scenario I doubt whether there's any data in the middlenames field, so it can be overwritten. The first name should stay on its own in the forenames field.
I can't get my head round this. Is there a way in SQL to do this in one command?
Thanks in advance for your replies.