3
I need to mount a Mysql query that returns the total of rows, and the total of lines with value greater than 1 in the same query.
Total of lines:
SELECT COUNT(*) FROM tabela
Total of lines with a value greater than 1:
SELECT COUNT(*) FROM `tabela` WHERE `valor` < 1
It would be like joining these two lines into one, and returning me the total of lines and the total of lines with value greater than 1.
And why do you have this requirement?
– Maniero
Why don’t I want to run two lines of code, and I can run it in one only
– Vinícius Lara
And what gain will you have like this?
– Maniero
We’re missing the point of the question
– Vinícius Lara
On the contrary, you are trying to get away from the focus of the question. Answering this is relevant.
– Maniero
Excuse me, it is not to be rude, however somewhere in the OS says that questions cannot be based on opinions etc etc.. But if you insist so much, I personally prefer to run on one line everything I need, why go twice to the bakery being that I can go only one and save my feet?
– Vinícius Lara
user3163662 I believe he is speculating a better way to formulate a good answer for you, is not necessarily a matter of opinion, but his last sentence makes sense (at least for me), maybe if the title was something like "How to count the number of lines in two different querys", but still it’s a good question.
– Guilherme Nascimento
It would be good to give a review, at that time stayed several s/ accept.
– Maniero