First: You posted this in the SQL Server and PostgreSQL forum.
Which database are you really using?
Second: you need to be a lot more specific about what you want. I have no idea what "to get inserted in every 7 days" should mean.
Remember the golden rules for posting:
- Post the structure of your table(s) by posting the necessary CREATE TABLE statements
- Post some sample data (ideally as INSERT INTO statements, so that we can create a test case easily)
- Post the expected output based on that sample data
And make sure all your SQL is readable by formatting it using [code] tags