我有这样的桌子:
服务:
+----+-----------+------------+-------------+
| id | name | service_id | description |
+----+-----------+------------+-------------+
| 1 | CHAT | 1 | |
| 2 | SMS | 1 | |
+----+-----------+------------+-------------+
服务特点:
+----+------------+------------+-------------+
| id | service_id | name | description |
+----+------------+------------+-------------+
|10 | 1 | Audio | |
|20 | 1 | Video | |
|30 | 2 | BULKSMS | |
+----+------------+------------+-------------+
客户服务:
+----+-----------+------------+----------------------------------+---------------------------------------------+
| id | client_id | service_id |service_features_id |service_values |
+----+-----------+------------+----------------------------------+---------------------------------------------+
|100 | 1000 | 1 |features:{10:enable, 20:disable} |values:{data_transfer:102400, quota:204800} |
|200 | 1001 | 2 |features:{30:enable} |values:{total_sms:100000, users:800} |
|300 | 1001 | 1 |features:{10:disable, 20:enable} |values:{quota:204800} |
+----+-----------+------------+----------------------------------+---------------------------------------------+
现在我想要任何键的服务值,即client_id 1000 的data_transfer 或quota 仅来自mysql select 查询。答案应分别为 102400 或 204800
有没有更好的方法来形式化表格或存储信息。请建议。