I’ve got the query:
select distinct index, name, code, amount as amount_min
from sales s
where (amount =
(
select mindex(s1.amount)
from sales s1
where s1.name = s.name
))
order by s.name
Query works very well, but I would like to modify them so that when the column index, code, amount in several rows are identical, only one show, the first row. The rest (although different code columns) should be ignored. Can someone help me?
Since I don’t know if it’s oracle, sql server, sybase ase, etc., you way to do it is like this:
Step 1: insert the data in a temporary table with an identity column
Step 2: make the needed select
Step 3: drop the temporary table