Home > database >  Sequelize used with postgres
Sequelize used with postgres

Time:09-20

Now have the following SQL statement, how to query in sequelize, very depressed, hope leaders help solve
TFile: file table tf
TFT TFType: file type table
TUser: user table tu
TModel: tm module table
TOption: operating logs to

Select tf. The name, tu tu_id, tu. Name, TFT. Name, coalesce (options. The count, 0) as the count, tr. Item, tf. The module, the tm. Name the from
"TFile tf
"The left outer join
"TFType" TFT on tf. Tf_id=TFT. Tft_id
The left outer join
"TUser" tu on tf. The owner=tu. Tu_id
The left outer join
"TRole" tr on tr. Tr_id=tu. Tr_id
The left outer join
"TModel" tm on tm_id=tf. The module
The left outer join
(select COUNT (tf_id) as the COUNT, tf_id from "TOption" where option_tye=1 group by tf_id) options
On the options. Tf_id=tf. Tf_id
Where tf. The module=any (tr. Item)

CodePudding user response:

Never used it, but recommend a Chinese document: https://itbilu.com/nodejs/npm/41qaV3czb.html
  • Related