Due to the needs of the project, we configure some infrequently variable constants through the data fields and update the data through the database fields when the system is initialized. The following is a description of the example.
I have a watch like this.
, you will find that Meterkindid and Measureid are code, only the data dictionary configured by the data can parse out the values we want, the following is the data dictionary table structure
, so the design is very flexible, FieldID for the column name, ID is the value of the table above, value is the parsed value, that is, the code corresponding to the name, and then send a dictionary of the data graph
MK001 and MK002 corresponding data dictionary of water meters and meters, MS001 and MS002 corresponding data dictionary measurement units are tons or degrees, then how we investigate this effect, such as:
, carefully comparing the above chart, you will find that the type and units are joined, before the long-thinking SQL statements are not written out, and later found a very convenient way, SQL statements are as follows
With this SQL, you can implement the requirements. However, if you encounter a problem, use stored procedures to report a. Pricetypeid not exist, depressed. Let's fix it.