Hi, I want a table in which i want to store reminders for users These are the columns i have in mind for the same id {int} Primary Key emp_id {int} Foreign Key to employee Table reminder {varchar} date {Datetime} Now i want these reminders to be yearly or quaterly depending upon how the user chooses it. Also me want them to be displayed, say, 15days before the date stored. So what should my SQL Query look like for the same. ? Regards, Akshay
Little more simplified form of you data model. Table: This will be reminder master table you can a type of reminder and than can use their ID for different table. Reminder 1. ReminderId 2. Reminder Name 3. Description 4. Created Date Employee Reminder 1. Employee ID 2. EmpReminder ID 3. ReminderDate Master table will reduce the repetition of reminder data. This reminderId can be assigned in employeereminder table Getting the data for 15day prior to the reminder data. Its in TSQL Select employeeID,ReminderName From Employee Reminder inner join reminder on reminderid= EmpReminder ID where reminderdate -15=getdate() It will show reminder 15 days before the reminder date IT may Help You