WITH clause not returning results in Question


#1

Hi,

I’ve just setup a query with a WITH clause:

WITH X_users AS (

)
SELECT

FROM X_users

When trying that in a Question I get the following message: “There was a problem with your question
Most of the time this is caused by an invalid selection or bad input value. Double check your inputs and retry your query.
I have the feeling that is because of the WITH clause but I was hoping someone could confirm that. It’s strange because the query works ok from the Native query, meaning that I can see the results. I even limited the results to 20000, just in case it had sth to do with that.

Any ideas?

Thanks a lot!
Raul.


#2

Hi Raul,
what database are you using with metabase? it seems that with mySQL you can´t write WITH clauses. But that might depend on your database. Just googled it and it seems it highly depends on version and database type if with clause is supported: https://stackoverflow.com/questions/324935/mysql-with-clause

Depending on what you want to achieve you might be able to rearrange your question?

To help other users that might have the same issue could you please add your metabase version number and the database type you use to your question? And also of course if you found a solution :slight_smile:
Cheers, Eva


#3

Hi Eva,

Thanks a lot for the quick reply. I did again from scratch and seems to work everywhere now. I don’t really know what it was but at least I can say that it wasn’t because of the WITH
I’ll make sure to include my version next time :slightly_smiling_face: