Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm looking to "prune" a table, basically after 24 hours I want to only keep one table entry for each hour (using the createdAt row) I've been searching the internet and Sequelize documentation all day with no luck so far.

What I have tried:

My SQL knowledge is very limited as well so thats really pulling me down here So far I've been able to come up with

SELECT HOUR(createdAt) FROM node_entries.DataEntries;
in SQL, this shows just the CreatedAt row by the hour, I now just need the Sequelize code to take this and delete all entries leaving one entry for each hour

Again, been searching the documentation and internet all day, even spoken with fellow devs who also arent sure how to do this, I'm hoping someone out there knows.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900