Reputation: 438
I am trying to do similar of
SELECT DISTINCT tid, open_dt from table_name
in prestodb
where these values are repeated in multiple rows with other column values changing. But, this doesn't seem to work. I have tried using
SELECT DISTINCT ROW(tid, open_dt) from table_name
, but this gives the results more like in json sort of format with one column having values as {field0='tid123', field1='2020-12-01'}
.
I want to use the query as an inner query in a join. Is there a way to do it and get the results like a normal table?
Upvotes: 2
Views: 3245
Reputation: 142173
You can use group by on all required columns:
SELECT tid, open_dt
FROM table_name
GROUP BY tid, open_dt
Upvotes: 2