How to combine a field from multiple tables into a single field in a MySQL
View?
I have multiple tables, each with a code field. I'd like to combine all
the values in the separate code fields into a new View in a single code
field. I only want distinct code values in the view. There are codes in
each table that don't exist in any of the other tables, and there are
codes in each table that exist in all the other tables.
What I'm trying to do with fake SQL that doesn't work:
CREATE VIEW codes AS
SELECT table_a.code AS code, table_b.code AS code, table_n.code AS code
FROM table_a, table_b, table_n;
No comments:
Post a Comment