[Solved] Combine first and last name into one field

Creating tables and queries
Post Reply
RBromer
Posts: 4
Joined: Fri May 31, 2019 3:30 pm

[Solved] Combine first and last name into one field

Post by RBromer »

I would like to create a field in a query that is the first plus last name with no extra spaces between the names. This is the best that I could come up with but it doesn't work.

SELECT "First" AS "First", "Last" AS "Last", "Dinner--Banquet" AS "Dinner", ("Competitor.First" || ' ' || "Competitor.Last" AS "Name" FROM "Competitor"

I am trying to create a report with name and 'dinner', which is the number of dinners ordered. There should be a line for each record on the report.

I previously did this in dBase Plus but I can't load it onto my new computer so I am starting over with OO Base.
Last edited by RBromer on Fri May 31, 2019 6:41 pm, edited 2 times in total.
Ruth Bromer, OpenOffice version 4.1.5, Windows 10
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Combine first and last name into one field

Post by FJCC »

This works for me to concatenate the two fields NOMBRE and VALOR with no space between them.

Code: Select all

SELECT "NOMBRE", "VALOR", "NOMBRE" || "VALOR" AS "BOTH" from "Tabla1"
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
RBromer
Posts: 4
Joined: Fri May 31, 2019 3:30 pm

Re: Combine first and last name into one field

Post by RBromer »

Well, I thought I had tried something like that, but I guess I never saved it and couldn't replicate it. ANyway, thank you. This worked. I even got the space in there. HEre is my command that works.

SELECT "First" AS "First", "Last" AS "Last", "Dinner--Banquet" AS "Dinner", "First" || ' ' || "Last" AS "Name" FROM "Competitor"

Thank you.
Ruth Bromer, OpenOffice version 4.1.5, Windows 10
Post Reply