I’m having trouble querying and combining two text fields into one in a subform in a way that updates the main form.
I have 2 tables:
"Composers"
with the columns: ID, First name, Last name, Year of birth
"Works"
with the columns: ID, name, genre, composer
where "composer"
is an INTEGER referencing Composers.ID
.
I made a form for creating records of the Works table. I’d like there to be a combo box for the “composer” field where all the options are formatted as: "Composers"."Last Name", "Composers"."First Name"
e.g.
Beethoven, Ludwig van
Brahms, Johannes
and that picking a composer from the list will update the current record in Works
with the correct composer
number.
I tried to create a subform on the Composers table, and used the following SQL statement:
SELECT "Last Name" || ', ' || "First Name" AS "Composer", "ID" FROM "Composers" INNER JOIN "Works" ON "Composers"."ID" = "Works"."Composer";
Unfortunately, that doesn’t work and won’t let me update/add composers to the current Works
record. How can I do this in Base?
Thank you!