【发布时间】:2018-11-04 22:00:00
【问题描述】:
当我使用 node.js 中的 pg 向数据库发送 LEFT JOIN 查询时,我有一个名为“ExternalCategories”的表,我得到了难以理解的结果
'SELECT * FROM "ExternalCategories" a Left JOIN "externalcat" b ON a."parentCategoryId"=b.id'
我明白了:
{
"id": 34,
"name": "Ordinateurs et Resea",
"img": null,
"views": 0,
"parentCategoryId": null
},
{
"id": null,
"name": null,
"img": null,
"views": null,
"parentCategoryId": null
},
{
"id": 1,
"name": "Vêtements",
"img": null,
"views": 0,
"parentCategoryId": null
},
{
"id": 34,
"name": "Ordinateurs et Resea",
"img": null,
"views": 0,
"parentCategoryId": null
},
但是当我在 Datagrip 或 pgAdmin4 中运行相同的查询时,我得到了正确的数据 Results in datagrip
【问题讨论】:
标签: node.js postgresql express node-postgres