1. I use a sql statement
of select b from table where billing 1 groupby c having d > 2 orderby b desc
.
2. At first, I thought the reason for reporting an error was that I thought that the order in which mysql is executed is from where groupby select having orderby
, so the data has been filtered out before having execution. There is no d
field in the data, so using having d > 2
will report an error because having did not have this field
but actually did not report an error. Before that, I remember that I also tested that it was wrong, and now I don"t know what happened. at first I thought it was a version problem. The version I"m testing now is mysql
3. I read the document on mysql"s official website and did not understand , and then found a lot of answers online. There are all kinds of from where group having select orderby
, and I don"t know to believe that now.
4. So ask the great gods about the order in which the sql of mysql executes sentences.