如何在每个下拉列表项选择上创建新表 [英] How to create new table on every drop down list item select

查看:83
本文介绍了如何在每个下拉列表项选择上创建新表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有会员表格,包括

姓名文本框

金额下降(1 Lac,2 Lac,3 Lac)

start日期文本框

结束日期文本框

地址文本框

手机文本框



i在数据库中创建了一个表格



但是

i希望将它们分成组(或者为每一滴创建新表)基于金额1 Lac group 2 lac group



因为我想根据开始日期结束日期为1 lac 2 lac项目创建不同的列



例如,如果我选择了1 lac并且开始日期为2015年1月6日和结束日期2015年1月12日,那么这6天是6个月,我添加了6列额外的桌子



否则





如果我选择2 lac并且开始日期2015年1月6日和结束日期2016年6月6日,这些天有12个月的持续时间,我在桌子上添加了12列





i有不同的列为1 Lac 2 Lac 3 Lac



请给我一个建议或示例先生

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

推荐答案

我真的不建议你这样做。首先,通常不会根据用户界面中的选择创建数据库表。表格本质上是静态的。



第二件事是你要在表格中动态创建不同数量的列,具体取决于所选的月份数量期。从长远来看,这将使所有查询和数据操作变得非常困难。



相反,创建一个子表来存储选择(1 lac,2 lac等)并且在同一个表或另一个子表中,将月份存储为行以及您要为该月存储的任何其他数据。使用这种方法,您的表结构保持静态,而月数可能会有所不同。
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.


这篇关于如何在每个下拉列表项选择上创建新表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆