0
need to do a query that searches for a column increasing and in the same query another column descending for example in the result below:
item | quantidade
carro | 400
carro | 340
dado | 240
disco | 180
disco | 120
faca | 89
faca | 59
I would like to see the result of this follow my query below:
SELECT * FROM qe.etiquetas_recortadas_aoi ignore index(PRIMARY)
where line = 'AOI-1'
and brand = 'NBK'
and material_name_crop <> 'Borrada_1'
order by qty_pass desc, material_name asc;
what is your mistake? I believe that in this way the
order by
work.– rLinhares
the syntax is correct. Your example of result does not match with select (item, quantity does not appear in query), but I believe it is material_name and qty_pass. If it is, just change the
order by
fororder by material_name asc, qty_pass desc
, but I couldn’t understand your problem....– Ricardo Pontual
@Ricardopunctual I also thought it was this, so much so that I answered and had not even seen your comment ! rs ... went by
qty_pass
be theint
andmaterial_name
thestring
of the example he gave, but the problem is that the example is ordered by the 2, and that is where he must have got confused in his.– rbz
It seems to be just that, just a matter of reversing the fields, funny that he got to the
order by
and not try to change the order of the camps :)– Ricardo Pontual
Just correcting,
String
nay,varchar
right ! rs– rbz