Reputation: 191
I have Table1 :
ID Name Tag Date
Result :
id Name Tag Date
I am trying to get the Tag detail for particular name based on min date. How to filter out the data because when i am doing big query i have to add Tag in group it goes back square one. can you help me
Upvotes: 1
Views: 494
Reputation: 172944
Consider below approach
select as value array_agg(t order by date limit 1)[offset(0)]
from your_table t
group by name
if applied to sample data in your question - output is
Upvotes: 2