How to display a name from a foreign key in a table?

Hello All,

I now have a table of contacts and a table of companies (I'm using the retool database). In the table of companies, there is a column with a foreign key to the contacts table. Now in the companies table I only see the id numbers of the contacts. But i would like to see the name. How can i get that done?

Some help would really be appreciated!

Thanks in advance,


Ps. I'm still learning all of this...


so i did some digging and some chatting :wink:.

the sql code below is for the readRow Query

SELECT,, customers.street,,,, AS contact_name
FROM "customers example" AS customers
LEFT JOIN "contact example" AS contacts ON customers.contact_person =;

In this query, the "contact_person" column of the "customers example" table is compared to the "id" column of the "contact example" table to retrieve the name of the corresponding contact person. This name is then renamed to "contact_name" using the "AS" operator in the SELECT statement.

With this query, you will get the name of the contact person instead of just the ID number.

I hope this helps someone else in the future!

Take care!


1 Like