I'm pretty new to OpenOfffice Base, but not to SQL.
I want to insert into a table the results of a join. It works in the simple case:
insert into "tbl1" ("last_name", "first_name")
select "last_name", "first_name" from "contacts"
but NOT with
insert into "tbl1" ("last_name", "first_name")
select "contacts.last_name", "contact2.first_name"
from "contacts" INNER JOIN "contact2"
on "contacts.last_name" = "contact2.last_name"
and "contacts.first_name" = "contact2.first_name"
I get this error:
1: Column not found: contacts.last_name in statement [insert into "tbl1" ("last_name", "first_name") select "contacts.last_name", "contact2.first_name" from "contacts" inner join "contact2" on "contacts.last_name" = "contact2.last_name" and "contacts.first_name" = "contact2.first_name"]
But contacts.last_name
exists and is populated with data.
I've checked docs and don't see it, so I hope someone provide what should be a simple answer. Also I'd like to know how I can write the results (instead of the insert) to a csv file. The INTO TEXT clause objects to the join, I think.
Thanks.