Use of table alias

I read here that we cannot use table alias.

But I need table alias for where exists into the same table itself. Like this

select col1, col2, col3 from table a
where exists (select 1 from table a2 where a.id = a2.id and a.col1=‘xxx’)

What is the workaround? I’m using v0.35.1

Thanks

1 Like

@erich.sw But you don’t need to alias a - just a2, which you’re not using for Field Filter anyway, so that shouldn’t be a problem.

For reference:
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type
https://github.com/metabase/metabase/issues/3324 - upvote by clicking :+1: on the first post

@flamber I guess you are right I don’t need that alias a
Thanks