Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COLUMN 1 TABLE VALUE IS A MERGE OF COLUMN 2 AND 3

Status
Not open for further replies.

spysab

IS-IT--Management
Jun 13, 2019
27
PH
Hi!


How can i combine table column "name and surname" into one column "full name"


stafflist.dbf

column 1 = name
column 2 = surname
column 3 = the value of column 1 and 2 combine to become a full name

Thanks
 
Code:
local lcFullname 

SELECT StaffList
GO TOP  
SCAN 
    SCATTER MEMVAR 
    lcFullname = ALLTRIM(m.column1) + " " + ALLTRIM(m.column2)
    replace column3 WITH lcFullname 
ENDSCAN 

GO TOP
 
Alternatively:

Code:
SELECT StaffList
REPLACE ALL Column3 WITH ALLTRIM(Column1) + " " + ALLTRIM(Column2)

(This assumes that Column1, Column2 and Column3 are your actual field names. In practice, the field names would probably be something like FirstName, LastName and FullName respectively. In that case, substitute the appropriate names in the above code.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top