Question on many tables


#1

Hello,

How to create a question on many tables for display all fields to display all the fields of the two tables?

Example on SQL

SELECT t0.itmref, t0.stofcy, t0.defloctyp, t1.itmsta, t2.itmtyp FROM itmfacilit
TO INNER JOIN itmmaster t1 ON T1.itmref = t0.itmref
INNER JOIN itmsales t2 ON t2.itmref = t0.itmref
WHERE
t0.defloc = ’ ’ AND
t1.itmstat <> 6 AND
t2.itmtyp = 1
ORDER BY t0.itmref

Thanks,
Philippe.


#2

Hi Philippe,
when using a sql database you can join the tables in sql syntax. I don´t think you can display all fields of lets say 2 tables with the metabase query builder, you would have to go to SQL syntax to do that:

grafik

Hope that helps, Eva


#3

Ah now you changed your question :slight_smile: so my first answer is no longer helpful.
What is your problem with your query then? it should work in sql syntax mode?
Does it run into an error or does it just not give you the fields you want?


#4

Hi Evas,

My goal is to allow users who do not know anything about sql to run queries.


#5

I’ve been designing some dashboards that take data from 10+ tables. I found the best approach was to just create a view on the database. It made the design much simpler and enabled reuse of the query across multiple questions. Also made it easier to add filters as they didn’t need to be incorporated in the original query.
For me, this is the only way to work as any query that only uses one table is only like to exist in demo data!