Table 1: classification Table, id,name
Table 2: data Table, id,name,diqu,class_id
I want to show all the result sets classified in "Table 1", and can associate "Table 2" to get the statistical quantity of all the data under the relevant categories. I need the diqu field of where like Table 2
how to write it?
has been writing for a long time and there is an error.
or the quantity can be counted, but the result set of Table 1 is incomplete
the simple way is to read all the result sets of "Table 1" first, and then cycle to "Table 2" for statistics. This can be achieved, but the efficiency can be imagined.