0

I am completely new to both nodejs and SQL / Sequelize. But I fight my way through!

I have a query here, which I would like to implement with Sequelize. If I am already informed, I can do this with sequelize.literal.

Maybe you can help me.

SELECT ytd.*
FROM youtubedata ytd
WHERE ytd.date = (SELECT MAX(ytd2.date) FROM youtubedata ytd2);

1 Answer 1

1

Something like this:

const items = await database.youtubedata.findAll({
where: Sequelize.where(Sequelize.col('date'), '=', Sequelize.literal('(SELECT MAX(ytd2.date) FROM youtubedata ytd2)'))
})
Sign up to request clarification or add additional context in comments.

1 Comment

With a few minor changes, it worked wonderfully. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.