Hi Edwin,

On Wed, 2024-05-22 at 16:01 +1000, Edwin Humphries wrote:
> Hi all
> 
> I need to copy the first word from an existing field and place it
> into a 
> new field. Is there a way to do that autoagically?

This might work for you, assuming the field with the text is called 
SELECT `YourTextField`, SUBSTR( `YourTextfield`, 1, LOCATE( ' ',
`YourTextfield` ) - 1 ) `FirstWord` FROM `YourTableName`

You can generate this in the query Design View, by just adding an extra
column with 
SUBSTR( `YourTextField`, 1, LOCATE( ' ', `YourTextfield` ) - 1 )
and, say, FirstWord as Alias.

The LOCATE function finds the position of the first space in the field.
The position less 1 is the LENGTH required by the SUBSTR function.

The experts may have an opinion on this.

Cheers
Harvey 



-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Reply via email to