我一周中的每一天都有七个表,分别命名为MondayTable,ThursdayTable,ThursdayTable,ThursdayTable,FridayTable。每个表有三列 travel_date,一年中的一周,销售。 Yearoftheyear是MySql的Week函数。
现在我正在运行SQL,例如按travel_date从MondayTable组中选择travel_date,sum(sale)。
我可以在yearoftheyear字段中联接表,以便输出看起来像
Weekoftheyear, Monday.travel_date, Monday.sale, Tuesday.travel_date, Tuesday.sale, Wednesday.travel_date, Wednesday.sale...
24, 2012-06-11, 56, 2012-06-12, 94, 2012-06-13, 102
25, 2012-06-18, 96, 2012-06-19, 99, 2012-06-20, 105