0
I need to sort my records by as many as GROUPINGS, that is, I have the SQL below and I need the column TYPE who is being grouped, is ordered from the largest cluster to the smallest, excluding the display of TYPE that does not have GROUPING.
(SELECT tipo, count(id) as quantidade
FROM imoveis
WHERE cod = '$cliente'
AND negociacao <> '0'
GROUP BY tipo)
ORDER BY quantidade DESC
I’m waiting for help.
Is the use of the label not valid? Humm.. I am without a tool to test at the moment, but I believe that the use of Abels is valid yes.
– Rubico
is valid yes I believe this is the answer he wants. + 1
– Marconi
@According to what I put what is missing is not to display the TYPE that has no grouping, because my intention is to display only the types that have groupings and exclude those that do not have.
– Gladison Neuza Perosini
I had not seen the excluded those who do not have, I will change the answer
– Rubico
@Rubico did not work friend. TYPE that has no grouping continues to be displayed.
– Gladison Neuza Perosini
What would you say by type that has no grouping? The type that has 0 immobles? It would show to give a DESC in your immovable table and post the result?
– Rubico
@Rubico Example: As TYPE I have the values: 2 , 8, 6, 8, 2 - Only display the groupings 2 and 8. Excluding the display of 6. Got it? Since 6 is alone.
– Gladison Neuza Perosini
I understood that you have 3 values and want to display 2 of them. But I don’t understand why, what makes these 8 and 2 to be displayed and 6 not? You’re telling me there is no immovable with type 6?
– Rubico
Let’s go continue this discussion in chat.
– Gladison Neuza Perosini