【发布时间】:2022-01-19 10:28:02
【问题描述】:
我有一个 json 变量,我在其中获取了所有数据。我想将一个特定的键和它的值插入到我表的特定列中。
这是一个例子:
{
'Code bati': 'Pas',
Etage: '0',
Zone: 'FST',
'Pièce': '000',
'Priorité': 5,
'Désignation': 'Salle de cours',
'Type d’installation': '',
'Date de mise en service': '',
"Date d'installation": '',
Maintenance: '',
'Entreprise ayant le contrat de maintenan': '',
'Date de visite': 44525,
Marque: 'Epson',
'Modèle': 'EB-1980WU',
'N° série': 'V5YF630231L',
'Heure Lampe': 1796,
Position: 'centré',
HDMI: 'oui',
VGA: 'oui',
Video: 'non',
Automate: 'MLC ???',
Liaison: 'RS232',
'Type écran': 'manuel',
'Cage sécurité': 'oui',
'Statut HDMI': 'à tester',
'Statut VGA': 'à tester'
},
这是我的数组,我想以键“Zone”及其属性“FST”为例,将它们插入到我的 postgres 数据库的特定表中。 你有解决办法吗?
【问题讨论】:
-
sql语句:
UPDATE your_target_table SET your_taget_column = your_json_data->>'Zone' WHERE your_condition_to select_the_row_to_update
标签: node.js arrays json postgresql insert