How to export all collections of sql query statements?

How to export all collections of sql query statements at once?
for example,

Hi @beta
I think something got lost in translation. What are you trying to do?

I want to export all the SQL statements below the collection at once.
For example, like this,
select * from tableA where {{nick}};
select * from tableB where {{nick}};
select * from tableC where {{nick}};
select * from tableD where {{nick}};

@beta
You cannot use a Field Filter on different tables in the same query, since it uses the referenced table.column - and aliases are not supported.

As you said, the querys are stored in metabase.db.mv.db
I want to export all these queryes;

@beta
Okay, that’s a very different question.
You’ll need a SQL query tool such as https://razorsql.com to read metabase.db.mv.db, which is a H2 database.
The Metabase questions are stored in the table report_card.

OK,Thank you very much,
maybe my previous expression is not clear.:joy:

Hi, if you want to do this in a single query, and the fields of the tables are somewhat comparable, you can use a SQL UNION to achieve this:

SELECT nick, name, foo FROM tableA WHERE {{nick}}
UNION ALL
SELECT nick, name, bar FROM tableB WHERE {{nick}}
UNION ALL
SELECT nick, name, NULL FROM tableC WHERE {{nick}}

@wvengen
No, you cannot use the same Field Filter on different tables, since aliases are not supported, and Metabase generates the SQL with full table.column syntax.

Ah, thanks. You are right :frowning:
Aliasing the table doesn’t help either (on PostgreSQL) because the schema is included.

Well you can use UNION ALL by replacing the WHERE clause with:
WHERE nick = {{your_selection}}

You don’t get a dropdown list but if you know what info you need it will do the trick.