Date: prev next · Thread: first prev next last
2024 Archives by date, by thread · List index


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+unsubscribe@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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.