我有3个文本文件,每个文件包含20个项目的列表。 每个新的一天都会添加一个新列。
我想以电子表格或电子表格类型的布局显示这些项目,每列与下一列相邻。
电子表格输出如下所示:
10-28-09 10-29-09 10-30-09 data1 data2 data3 data1 data2 data3 data1 data2 data3我正在考虑将数据安排在mysql数据库中,然后执行一个查询来简化过程,但我无法弄清楚如何做一些事情。
我可以像这样安排数据:数据库模式; fields:varchar(50) 栏目名称=日期:10-30-09(星期一至五);
该查询将很简单,然后:“SELECT * FROM table1”
数据需要水平扩展,因此需要每天创建一个新列。
如果我按照这样的日期来安排数据,我不确定查询会将输出变为日期列:
id name date 1 data1 10-28-09 2 data1 10-28-09 3 data1 10-28-09 4 data2 10-29-09 5 data2 10-29-09 6 data2 10-29-09 7 data3 10-30-09 8 data3 10-30-09 9 data3 10-30-09我正在考虑添加一个排序列,并为每个日期的所有行增加1-20,但那么您需要以某种方式加入每个日期,输出结果会是:
10-28-09 10-29-09 10-30-09 data1 data2 data3 data1 data2 data3 data1 data2 data3I have 3 text files each of which contains a list of 20 items. A new column will be added per new day.
I'd like to display these items in a spreadsheet or spreadsheet type layout with each column adjacent to the next.
Spreadsheet output like:
10-28-09 10-29-09 10-30-09 data1 data2 data3 data1 data2 data3 data1 data2 data3I'm thinking of arranging the data in a mysql database, and execute a query to simply the process, however I can't figure out how to do a few things.
I can arrange the data like this: DB schema; fields: varchar (50) Columns name = date: 10-30-09 ( mon - fri);
The query would be simple then: "SELECT * FROM table1"
The data needs to expand horizontally so a new column needs to be created by day.
If I was to arrange the data by date like this, I'm not sure what the query would be to get the output into dated columns:
id name date 1 data1 10-28-09 2 data1 10-28-09 3 data1 10-28-09 4 data2 10-29-09 5 data2 10-29-09 6 data2 10-29-09 7 data3 10-30-09 8 data3 10-30-09 9 data3 10-30-09I was thinking of adding a sort column and increment it 1-20 for all rows per date, but then you would need to join on every date somehow, again the output would be:
10-28-09 10-29-09 10-30-09 data1 data2 data3 data1 data2 data3 data1 data2 data3最满意答案
您不应该尝试将数据安排在数据库的数据库列中,您应该编写一个前端来安排数据。 你当然不应该每天修改表格来添加一列。
有可能你真正想要做的是在你的数据中有20列,并且每天添加一行。 然后,转换数据对于您的前端来说是相对容易的工作,但从您的问题中不清楚为什么您要这样做。
You shouldn't try to arrange your data in database columns from the database, you should write a front end to arrange the data. You certainly shouldn't be modifying the table every day to add a column.
It's possible that what you really want to do is have 20 columns in your data and add a row each day. Then transposing the data is a relatively easy job for your front end, but it's unclear from your question why you are trying to do this.
更多推荐
发布评论