【问题标题】:Create data template using SQL Server 2000使用 SQL Server 2000 创建数据模板
【发布时间】:2017-03-02 07:26:20
【问题描述】:

通过使用 SQL Server 2000,我想使用 table1 和 table2 中的数据创建如下所示的输出数据模板

输出数据模板

Unit1   | Sale_value_1  | Sale_value_2|
-------------------------------------------    
chart1  | 25             |12|
chart2  | 30             |0|
chart3  | 56             |0|
chart4  | 41             |98|

表1

Date        |Unit1  |Sale_value_1|
------------------------------------    
2/11/2014   |chart1 |25|
2/11/2014   |chart2 |30|
2/11/2014   |chart3 |56|
2/11/2014   |chart4 |41|

表2

Date        |Unit1  |Sale_value_2|
-----------------------------------    
2/11/2014   |chart1 |12|
2/11/2014   |chart2 |0|
2/11/2014   |chart3 |0|
2/11/2014   |chart4 |98|

【问题讨论】:

  • 附带说明,您的输出数据模板的“技术术语”在白话中没有任何意义。如果您说我要创建输出结果集或输出表,我相信会更清楚。

标签: sql-server templates sql-server-2000


【解决方案1】:

这个SQL Fiddle 演示了以下查询:

SELECT t1.Unit1, t1.Sale_value_1, t2.Sale_value_2 
FROM Table1 as t1
INNER JOIN Table2 as t2 ON t1.Unit1 = t2.Unit1

【讨论】:

    猜你喜欢
    • 2017-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-20
    • 2013-02-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多