【发布时间】:2012-10-08 01:14:27
【问题描述】:
我在 mysql 中有 15 个不同列数的表。列数范围从 225 到 250。我每天从 15 个不同的 CSV 文件中导入数据。
所有表都有 19 个公共列,特定日期的值相同,3 个公共列的组合可以作为主键。
我需要从 15 个表格中提取数据而不重复,以将其显示为报告。如何做到这一点?
供参考的示例表结构如下:
<html>
<table cellpadding="0" cellspacing="auto" border="1" class="display" id="example" width="100%">
<thead>
<tr>
<th>Start time </th>
<th>End time </th>
<th>Query Granularity</th>
<th>RNC ID</th>
<th>Cell</th>
<th>Cellname</th>
<th>Access Success Rate Signalling (%)</th>
<th>Access Success Rate Speech (%)</th>
<th>Access Success Rate PS (%)</th>
<th>Access Success Rate HS (%)</th>
<th>Call Drop Rate Speech (%)</th>
<th>Call Drop Rate PS (%)</th>
<th>Call Drop Rate HS (%)</th>
<th>HOSR Speech (%)</th>
<th>iRAT HOSR out Speech (%)</th>
<th>iRAT HOSR out PS R99 (%)</th>
<th>number of rab establishment success for speech</th>
<th>number of rab establishment success for PS</th>
<th>number of rab establishment success for HS </th>
<th>number of CS call drop </th>
</tr>
</thead>
<tbody>
</table>
</html>
【问题讨论】:
-
在将 3 个公共列作为复合主键后尝试对所有表进行联合。但由于表中的列不同,它不起作用。请建议。
-
为了使联合工作,所有选择语句必须具有相同数量的字段名称
-
完全正确,Ertunc。谢谢你的建议。我试图将三个作为复合主键。但不能对多个表使用复合主键的组合。如果您有任何想法,请提出建议。
-
要使用联合,您可以使用空白/虚拟列来填充您的查询,以便每个具有相同数量的列。例如。
select '' as dummycol
标签: mysql database database-design normalization