I am creating a virtual layer in QGIS using the following statement:
SELECT * FROM (
SELECT * FROM a UNION ALL
SELECT * FROM b UNION ALL
SELECT * FROM c
) AS merged_tables
What is the best way to add a column to merged_tables containing the layer name of the source tables (in this case: a, b, c)? It would also be nice to be able to include the path to the source for a, b and c.