简体   繁体   English

将多个Excel工作表中的数据合并到一个表中

[英]Data from multiple excel sheets into one table

I'm relatively new to using sql and have a question. 我对使用sql比较陌生,并且有一个问题。

I have 4 excel sheets, each 99 lines long with 4 columns. 我有4个Excel工作表,每行99行,有4列。 I imported these into sql server and have 4 seperate tables now. 我将它们导入sql server,现在有4个单独的表。 Fields are; 字段是;

Brand, CL, Budget and Year. 品牌,CL,预算和年份。

tables are : Hotel, KASum, Offtrade and Ontrade 表格是:酒店,KASum,Offtrade和Ontrade

Each sheet (also each table as well) represent one sales channel. 每个工作表(也包括每个表)代表一个销售渠道。

I need to create a report about the sales of each channel. 我需要创建有关每个渠道销售情况的报告。 In order to do this i'm trying to build a query. 为了做到这一点,我试图建立一个查询。 So far i put all the data into one temp table but can't manage to seperate them according to their channels now. 到目前为止,我将所有数据放入一个临时表中,但是现在无法根据它们的通道将它们分开。 Any help? 有什么帮助吗?

PS: I hope my definition is clear and excuse my language if i have any mistakes. PS:我希望我的定义很清楚,如果有任何错误,请原谅我的语言。

Try adding a column to each sheet indicating the channel before you upload. 上载之前,请尝试在每个工作表上添加一列以指示频道。 Or maybe during the upload depending on how you're doing that. 或者在上传过程中,具体取决于您的操作方式。 So that the Hotel sheet would have a column that has "Hotel" all the way down. 这样,“酒店”表中的列将一直向下包含“酒店”。 Now you can merge then without losing the original channel info. 现在,您可以合并而不会丢失原始频道信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM