• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL query for deriving DATE

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my Jsp program, i have 3 schemes, one for 1 month, second for 3 month, and third for 12 month.
Now an user can create his account and select any of the 3 schemes, what i want is that in my database table there are two columns one is tha startdate colume which holds data for the date posted, ie, current date, and the other column is the enddate which holds data for the expiry date depending on the schemes selected....
What i want is that when a user register for an account his startdate is the present date and i want a query which automatically calculates the enddate keeping in mind the scheme and update the table with the derived result.
Thanks
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try some thing like this if it is DB2

Insert into SCEMETABLE (CRT_DT , EXP_DT) values ( current date , current date + 15 MONTHS )

You Can build the Query dynamically to pass the months depending on the scheme and execute it.

Hope this helps.

Thanks and Regards,
Arul.
 
reply
    Bookmark Topic Watch Topic
  • New Topic