Foreign Key with concatanated First, Last Names

#1

I have a “contacts” table that has" first" and “last” name fields and I have an “Agents” table. I want to assign a foreign key to the “agent” table and select the “full name” of a contact. As far as I’m aware you can’t concatenate values into another “full-name” field and have to do it via SQL Concat query. Can anyone suggest how I might achieve this end result, please?

#2

@noelfraser,

I am not sure about concatenates as I don’t use them. The way I handled that situation is I have my contacts table populated with all the contact information and in my other tables, I refer back to the contacts table.

For illustrate it, I have a contact in the contacts table with and ‘id’ of 1. In my other tables I have fk_id_contacts. I then have a simple database query to pull the information from the contacts table based on whatever number is in the fk_id_contacts field.

With wappler, it is wicked easy to accomplish this by adding a sever connect database query to pull the information based on the value of the field.

2 Likes
#3

Thanks Scott - I’ll give this a try