i have a table with these are not unique. so, i have multiple rows of such as shown below:
I hope you got the idea of the data in the table. I want to fetch all the rows from this table with unique so the fetch should display data something like this
Can you give me a query for this kind of result fetching? thanks in advance
i want to select unique with a good value of good value means, C123.. kind of string in case values are 0 and C123.. 0 in case all the values are 0. Other than zero, the other string value will always be same.
select tyche_id,max(summit_id) from "your table" group by tyche_id.
the group by will get you uniqueness of the tyche_ids and the aggregate function will get you some meaningful value for the summit_id, unless it's 0 in which case it will return the 0. It's a bit of a kludge, but it might work. Otherwise, you will have to use a combination of join, group by and case statements to craft the result set more precisely to your needs.