Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have membership form that includes
Name text box
Amount drop down(1 Lac,2 Lac,3 Lac)
start date text box
end date text box
Address text box
Mobile text box

i have created a table for this in database

but
i want to divide them as groups(or creating new table for every drop down item) based on amount 1 Lac group 2 lac group

because i want to create different columns for 1 lac 2 lac items based on start date end date

for example if i selected 1 lac and start date 1/6/2015 and end date 1/12/2015 , 6 months are duration in these days, i am adding 6 columns extra to the table

otherwise


if i selected 2 lac and start date 1/6/2015 and end date 1/6/2016 , 12 months are duration in these days, i am adding 12 columns extra to the table


i have different columns for 1 Lac 2 Lac 3 Lac

please give me a suggestion or example sir
Posted
Comments
Herman<T>.Instance 24-Jul-15 2:54am    
add an entity column to your table which indicates which lac is involved..

1 solution

I really wouldn't advice you to do this. First of all normally database tables are not created based on selections in user interface. Tables are static in nature.

The second thing is that you're going to create dynamically different amount of columns in the table depending on the amount of months in the selected period. This will make all queries and data manipulation really hard in the long run.

Instead, create a child table where you store the selection (1 lac, 2 lac etc) and aither in the same table or in another child table store the months as rows along with any other data you want to store for the month. Using this kind of approach your table structure stays static while the amount of months still may vary.
 
Share this answer
 
Comments
Member 11382784 31-Jul-15 1:50am    
thanks for your help sir..
i have to create different columns for 1 lac 2 lac 3 lac ... and you answered my latest question sir,in that am creating automatically calculations based on start date and end date ,
if user selected 1 Lac i have fixed 12(month) columns in database
if user selected 2 Lac i have 18(month) columns in database
so, if user click submit button , i want to save the details separately for 1 lac group 2 lac group 3 lac group....in child table or separate table.
Wendelius 1-Aug-15 1:46am    
Can you write a small sample data so that I would understand the requirement better?

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