带有多个变量的mysql表结构 [英] mysql table structure with multiple variables

查看:84
本文介绍了带有多个变量的mysql表结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个脚本,该脚本将根据不同条件对票证数量进行计数并将其存储在摘要表中.我无法理解如何构造我的表,因为会有超过1个变量.

I am writing a script which will counts the number of ticket as per as different conditions and store the count in a summary table. I am unable to understand how to structure my table since there will be more than 1 variables.

该脚本每周运行一次,每次执行都会增加一个新的星期.新的月份开始并执行脚本后,将添加一个新的月份,而新的一年开始后将添加一个新的年份.简而言之,我也有一些也是变量的列.不知道如何处理它和构建我的数据库.

The script will run every week and with each execution a new week will be added. Once the new month starts and scripts execute, a new month will be added and once new year starts a new year will be added. So in a nutshell I have columns which are also variables. Not sure how to handle it and structure my db.

推荐答案

具有日期服务计数列.

就这样.

Date            Service      Count
16 May 2016     Service1     35

然后,当您要在报表中显示它们时,请根据需要旋转它们.最好将日期设置为INT,并使用日期和服务的自动编号PK或复合PK.

Then when you go to display them in the report pivot them as you want. Probably better to make date an INT and either an auto number PK or composite PK of Date and Service.

这篇关于带有多个变量的mysql表结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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