Writing SQL queries inside Metabase SQL is really strange. It requires, for example, quotation marks around a column name I am sorting by. I suspect there are some settings somewhere, or a different place to write sql.
I’d really like to write something like:
Select ordh.ordernumber, ordl.itemnumber from orderheader ordh, orderline ordl
where ordl.ordernumber = ordh.ordernumer
and ordh.orderdate > “02/01/2021”
Can anyone advise?
I think you have been using some settings in MS. The T-SQL standard is to wrap schema/table/column in quotes (
") (if they contains spaces or other special characters), and single-quote (
') for string values.
Metabase sends what you write to your database - it only parses and changes the query if there are any variables.
But there are no settings or other places to write SQL in Metabase.
Thanks. That is starting to make sense, but I do see some SQL from our developers that looks like what I wrote above. I just can’t get it to work. Even in the metabase knowledge base it shows queries without quotes …
@grega1 You say it doesn’t work - what exactly does that mean? Are you seeing an error? Getting wrong results? …?
I have to say right now that I revisited my query based on what you said earlier and it seems to work. I was getting errors saying a field did not exist, although it did.
So, tail between my legs …