MySQL比较两个表并添加缺失值

时间:2017-04-03 10:51:28

标签: mysql

我有一张表ps_feature:

-------------
|id_feature |
-------------
|1          |
|2          |
|3          |
|4          |
|5          |
|6          |
-------------

和表ps_feature_lang:

--------------------------------
|id_feature | id_lang  | name  |
--------------------------------
|1          | 1        | text1 |
|2          | 1        | text2 |
|4          | 1        | text3 |
|5          | 1        | text4 |
--------------------------------

是否有一个MySQL脚本在PhPMyAdmin中运行来比较两个表并在ps_feature_lang中添加缺失值?

结果应为:

--------------------------------
|id_feature | id_lang  | name  |
--------------------------------
|1          | 1        | text1 |
|2          | 1        | text2 |
|3          | 1        | N/A   |
|4          | 1        | text3 |
|5          | 1        | text4 |
|6          | 1        | N/A   |
--------------------------------

感谢。

1 个答案:

答案 0 :(得分:1)

要完成单一语言,您可以使用Control

from scipy.cluster.vq import kmeans,vq
nbStates = 4
Centers, _ = kmeans(Data, nbStates)
Data_id, _ = vq(Data, Centers)