nodejs sqlクエリー
ルーティングクエリ
const query = 'insert into comments (comment, postId, userId) values(:comment, :postId ,:userId);';
await sequelize.query(query, {
replacements: {
comment: comment,
postId : postId,
userId : user.userId},
type: sequelize.QueryTypes.INSERT
}
);
市場照会const post = await posts.findAll(
{ include: [{model :comments, attributes: ['comment']},
{ model : users , attributes: ['userId','email','profile']},
{ model : likes }] },
);
サブクエリDELETE FROM items WHERE id = (SELECT id) FROM products);
INSERT INTO items (SELECT * FROM products);
Reference
この問題について(nodejs sqlクエリー), 我々は、より多くの情報をここで見つけました https://velog.io/@wooya/nodejs-sql-시퀄라이즈-쿼리テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol