大家好我在SQL Server中生成查询时遇到问题。 我有一张包含此记录的表
+-------+--------------+------+
|field 1|field 2 |field3|
+-------+--------------+------+
|B395 |B.U. 2013 |1002 |
+-------+--------------+------+
|B395 |LOCATION 2013 | |
+-------+--------------+------+
|B395 |MATERIALI 2013|3304 |
+-------+--------------+------+
|B395 |REVENUES 2013 |2202 |
+-------+--------------+------+
|B396 |B.U. 2013 |1002 |
+-------+--------------+------+
|B396 |LOCATION 2013 | |
+-------+--------------+------+
|B396 |MATERIALI 2013|3304 |
+-------+--------------+------+
|B396 |REVENUES 2013 |2202 |
+-------+--------------+------+
我想要一个像这样返回的查询
+------+--------------+-------------+-------------------+------------------+
|Field1|field2 |field3 |field4 |field5 |
+------+--------------+-------------+-------------------+------------------+
|B395 |B.U. 2013 1002|LOCATION 2013|MATERIALI 2013 3304|REVENUES 2013 2202|
+------+--------------+-------------+-------------------+------------------+
|B396 |B.U. 2013 1002|LOCATION 2013|MATERIALI 2013 3304|REVENUES 2013 2202|
+------+--------------+-------------+-------------------+------------------+
我可以用左连接吗?
非常感谢
答案 0 :(得分:0)
你没有特别清楚你要做什么但是看看你的数据我相信以下内容会起作用:
SELECT
[field 1] = bu.[field 1]
,[field 2] = bu.[field 2] + ' ' + bu.[field 3]
,[field 3] = loc.[field 2]
,[field 4] = mat.[field 2] + ' ' + mat.[field 3]
,[field 5] = rev.[field 2] + ' ' + rev.[field 3]
FROM
tableName bu
LEFT JOIN tableName loc ON loc.[field 1] = bu.[field 1]
LEFT JOIN tableName mat ON mat.[field 1] = bu.[field 1]
LEFT JOIN tableName rev ON rev.[field 1] = bu.[field 1]
WHERE
LEFT(bu.[field 1],4) = 'B.U.'
AND LEFT(loc.[field 1],8) = 'LOCATION'
AND LEFT(loc.[field 1],9) = 'MATERIALI'
AND LEFT(loc.[field 1],8) = 'REVENUES'
我假设结果表中的字段是Field 2
和Field 3
的复合,将LEFT JOIN
更改为INNER JOIN
将意味着所有列是必需的。上面还要求在填充之前B.U.
条目存在,但是您可以在必要时再次更改加入。
答案 1 :(得分:0)
我尝试将您的查询用于我的数据库字段名称,但结果是0记录,但没有 条件我有这个结果:
B395 B.U. 2013 1002 B.U. 2013 1002 B.U. 2013 1002 B395 B.U. 2013 1002 B.U. 2013 1002 B.U. 2013 1002 B395 B.U. 2013 1002 B.U. 2013 1002 B.U. 2013 1002 B395 B.U. 2013 1002 B.U. 2013 1002 B.U. 2013 1002 B395 B.U. 2013 1002 B.U. 2013 1002 LOCATION 2013 B395 B.U. 2013 1002 B.U. 2013 1002 LOCATION 2013 B395 B.U. 2013 1002 B.U. 2013 1002 LOCATION 2013 B395 B.U. 2013 1002 B.U. 2013 1002 LOCATION 2013 B395 B.U. 2013 1002 B.U. 2013 1002 MATERIALI 2013 3304 B395 B.U. 2013 1002 B.U. 2013 1002 MATERIALI 2013 3304 B395 B.U. 2013 1002 B.U. 2013 1002 MATERIALI 2013 3304 B395 B.U. 2013 1002 B.U. 2013 1002 MATERIALI 2013 3304 B395 B.U. 2013 1002 B.U. 2013 1002 REVENUES 2013 2202 B395 B.U. 2013 1002 B.U. 2013 1002 REVENUES 2013 2202 B395 B.U. 2013 1002 B.U. 2013 1002 REVENUES 2013 2202 B395 B.U. 2013 1002 B.U. 2013 1002 REVENUES 2013 2202 B395 B.U. 2013 1002 LOCATION 2013 B.U. 2013 1002 B395 B.U. 2013 1002 LOCATION 2013 B.U. 2013 1002 B395 B.U. 2013 1002 LOCATION 2013 B.U. 2013 1002 B395 B.U. 2013 1002 LOCATION 2013 B.U. 2013 1002 B395 B.U. 2013 1002 LOCATION 2013 LOCATION 2013 B395 B.U. 2013 1002 LOCATION 2013 LOCATION 2013 B395 B.U. 2013 1002 LOCATION 2013 LOCATION 2013 B395 B.U. 2013 1002 LOCATION 2013 LOCATION 2013 B395 B.U. 2013 1002 LOCATION 2013 MATERIALI 2013 3304 B395 B.U. 2013 1002 LOCATION 2013 MATERIALI 2013 3304 B395 B.U. 2013 1002 LOCATION 2013 MATERIALI 2013 3304 B395 B.U. 2013 1002 LOCATION 2013 MATERIALI 2013 3304 B395 B.U. 2013 1002 LOCATION 2013 REVENUES 2013 2202 B395 B.U. 2013 1002 LOCATION 2013 REVENUES 2013 2202 B395 B.U. 2013 1002 LOCATION 2013 REVENUES 2013 2202 B395 B.U. 2013 1002 LOCATION 2013 REVENUES 2013 2202 B395 B.U. 2013 1002 MATERIALI 2013 3304 B.U. 2013 1002 B395 B.U. 2013 1002 MATERIALI 2013 3304 B.U. 2013 1002 B395 B.U. 2013 1002 MATERIALI 2013 3304 B.U. 2013 1002 B395 B.U. 2013 1002 MATERIALI 2013 3304 B.U. 2013 1002 B395 B.U. 2013 1002 MATERIALI 2013 3304 LOCATION 2013 B395 B.U. 2013 1002 MATERIALI 2013 3304 LOCATION 2013 B395 B.U. 2013 1002 MATERIALI 2013 3304 LOCATION 2013 B395 B.U. 2013 1002 MATERIALI 2013 3304 LOCATION 2013 B395 B.U. 2013 1002 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 B.U. 2013 1002 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 B.U. 2013 1002 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 B.U. 2013 1002 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 B.U. 2013 1002 MATERIALI 2013 3304 REVENUES 2013 2202 B395 B.U. 2013 1002 MATERIALI 2013 3304 REVENUES 2013 2202 B395 B.U. 2013 1002 MATERIALI 2013 3304 REVENUES 2013 2202 B395 B.U. 2013 1002 MATERIALI 2013 3304 REVENUES 2013 2202 B395 B.U. 2013 1002 REVENUES 2013 2202 B.U. 2013 1002 B395 B.U. 2013 1002 REVENUES 2013 2202 B.U. 2013 1002 B395 B.U. 2013 1002 REVENUES 2013 2202 B.U. 2013 1002 B395 B.U. 2013 1002 REVENUES 2013 2202 B.U. 2013 1002 B395 B.U. 2013 1002 REVENUES 2013 2202 LOCATION 2013 B395 B.U. 2013 1002 REVENUES 2013 2202 LOCATION 2013 B395 B.U. 2013 1002 REVENUES 2013 2202 LOCATION 2013 B395 B.U. 2013 1002 REVENUES 2013 2202 LOCATION 2013 B395 B.U. 2013 1002 REVENUES 2013 2202 MATERIALI 2013 3304 B395 B.U. 2013 1002 REVENUES 2013 2202 MATERIALI 2013 3304 B395 B.U. 2013 1002 REVENUES 2013 2202 MATERIALI 2013 3304 B395 B.U. 2013 1002 REVENUES 2013 2202 MATERIALI 2013 3304 B395 B.U. 2013 1002 REVENUES 2013 2202 REVENUES 2013 2202 B395 B.U. 2013 1002 REVENUES 2013 2202 REVENUES 2013 2202 B395 B.U. 2013 1002 REVENUES 2013 2202 REVENUES 2013 2202 B395 B.U. 2013 1002 REVENUES 2013 2202 REVENUES 2013 2202 B395 LOCATION 2013 B.U. 2013 1002 B.U. 2013 1002 B395 LOCATION 2013 B.U. 2013 1002 B.U. 2013 1002 B395 LOCATION 2013 B.U. 2013 1002 B.U. 2013 1002 B395 LOCATION 2013 B.U. 2013 1002 B.U. 2013 1002 B395 LOCATION 2013 B.U. 2013 1002 LOCATION 2013 B395 LOCATION 2013 B.U. 2013 1002 LOCATION 2013 B395 LOCATION 2013 B.U. 2013 1002 LOCATION 2013 B395 LOCATION 2013 B.U. 2013 1002 LOCATION 2013 B395 LOCATION 2013 B.U. 2013 1002 MATERIALI 2013 3304 B395 LOCATION 2013 B.U. 2013 1002 MATERIALI 2013 3304 B395 LOCATION 2013 B.U. 2013 1002 MATERIALI 2013 3304 B395 LOCATION 2013 B.U. 2013 1002 MATERIALI 2013 3304 B395 LOCATION 2013 B.U. 2013 1002 REVENUES 2013 2202 B395 LOCATION 2013 B.U. 2013 1002 REVENUES 2013 2202 B395 LOCATION 2013 B.U. 2013 1002 REVENUES 2013 2202 B395 LOCATION 2013 B.U. 2013 1002 REVENUES 2013 2202 B395 LOCATION 2013 LOCATION 2013 B.U. 2013 1002 B395 LOCATION 2013 LOCATION 2013 B.U. 2013 1002 B395 LOCATION 2013 LOCATION 2013 B.U. 2013 1002 B395 LOCATION 2013 LOCATION 2013 B.U. 2013 1002 B395 LOCATION 2013 LOCATION 2013 LOCATION 2013 B395 LOCATION 2013 LOCATION 2013 LOCATION 2013 B395 LOCATION 2013 LOCATION 2013 LOCATION 2013 B395 LOCATION 2013 LOCATION 2013 LOCATION 2013 B395 LOCATION 2013 LOCATION 2013 MATERIALI 2013 3304 B395 LOCATION 2013 LOCATION 2013 MATERIALI 2013 3304 B395 LOCATION 2013 LOCATION 2013 MATERIALI 2013 3304 B395 LOCATION 2013 LOCATION 2013 MATERIALI 2013 3304 B395 LOCATION 2013 LOCATION 2013 REVENUES 2013 2202 B395 LOCATION 2013 LOCATION 2013 REVENUES 2013 2202 B395 LOCATION 2013 LOCATION 2013 REVENUES 2013 2202 B395 LOCATION 2013 LOCATION 2013 REVENUES 2013 2202 B395 LOCATION 2013 MATERIALI 2013 3304 B.U. 2013 1002 B395 LOCATION 2013 MATERIALI 2013 3304 B.U. 2013 1002 B395 LOCATION 2013 MATERIALI 2013 3304 B.U. 2013 1002 B395 LOCATION 2013 MATERIALI 2013 3304 B.U. 2013 1002 B395 LOCATION 2013 MATERIALI 2013 3304 LOCATION 2013 B395 LOCATION 2013 MATERIALI 2013 3304 LOCATION 2013 B395 LOCATION 2013 MATERIALI 2013 3304 LOCATION 2013 B395 LOCATION 2013 MATERIALI 2013 3304 LOCATION 2013 B395 LOCATION 2013 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 LOCATION 2013 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 LOCATION 2013 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 LOCATION 2013 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 LOCATION 2013 MATERIALI 2013 3304 REVENUES 2013 2202 B395 LOCATION 2013 MATERIALI 2013 3304 REVENUES 2013 2202 B395 LOCATION 2013 MATERIALI 2013 3304 REVENUES 2013 2202 B395 LOCATION 2013 MATERIALI 2013 3304 REVENUES 2013 2202 B395 LOCATION 2013 REVENUES 2013 2202 B.U. 2013 1002 B395 LOCATION 2013 REVENUES 2013 2202 B.U. 2013 1002 B395 LOCATION 2013 REVENUES 2013 2202 B.U. 2013 1002 B395 LOCATION 2013 REVENUES 2013 2202 B.U. 2013 1002 B395 LOCATION 2013 REVENUES 2013 2202 LOCATION 2013 B395 LOCATION 2013 REVENUES 2013 2202 LOCATION 2013 B395 LOCATION 2013 REVENUES 2013 2202 LOCATION 2013 B395 LOCATION 2013 REVENUES 2013 2202 LOCATION 2013 B395 LOCATION 2013 REVENUES 2013 2202 MATERIALI 2013 3304 B395 LOCATION 2013 REVENUES 2013 2202 MATERIALI 2013 3304 B395 LOCATION 2013 REVENUES 2013 2202 MATERIALI 2013 3304 B395 LOCATION 2013 REVENUES 2013 2202 MATERIALI 2013 3304 B395 LOCATION 2013 REVENUES 2013 2202 REVENUES 2013 2202 B395 LOCATION 2013 REVENUES 2013 2202 REVENUES 2013 2202 B395 LOCATION 2013 REVENUES 2013 2202 REVENUES 2013 2202 B395 LOCATION 2013 REVENUES 2013 2202 REVENUES 2013 2202 B395 MATERIALI 2013 3304 B.U. 2013 1002 B.U. 2013 1002 B395 MATERIALI 2013 3304 B.U. 2013 1002 B.U. 2013 1002 B395 MATERIALI 2013 3304 B.U. 2013 1002 B.U. 2013 1002 B395 MATERIALI 2013 3304 B.U. 2013 1002 B.U. 2013 1002 B395 MATERIALI 2013 3304 B.U. 2013 1002 LOCATION 2013 B395 MATERIALI 2013 3304 B.U. 2013 1002 LOCATION 2013 B395 MATERIALI 2013 3304 B.U. 2013 1002 LOCATION 2013 B395 MATERIALI 2013 3304 B.U. 2013 1002 LOCATION 2013 B395 MATERIALI 2013 3304 B.U. 2013 1002 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 B.U. 2013 1002 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 B.U. 2013 1002 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 B.U. 2013 1002 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 B.U. 2013 1002 REVENUES 2013 2202 B395 MATERIALI 2013 3304 B.U. 2013 1002 REVENUES 2013 2202 B395 MATERIALI 2013 3304 B.U. 2013 1002 REVENUES 2013 2202 B395 MATERIALI 2013 3304 B.U. 2013 1002 REVENUES 2013 2202 B395 MATERIALI 2013 3304 LOCATION 2013 B.U. 2013 1002 B395 MATERIALI 2013 3304 LOCATION 2013 B.U. 2013 1002 B395 MATERIALI 2013 3304 LOCATION 2013 B.U. 2013 1002 B395 MATERIALI 2013 3304 LOCATION 2013 B.U. 2013 1002 B395 MATERIALI 2013 3304 LOCATION 2013 LOCATION 2013 B395 MATERIALI 2013 3304 LOCATION 2013 LOCATION 2013 B395 MATERIALI 2013 3304 LOCATION 2013 LOCATION 2013 B395 MATERIALI 2013 3304 LOCATION 2013 LOCATION 2013 B395 MATERIALI 2013 3304 LOCATION 2013 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 LOCATION 2013 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 LOCATION 2013 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 LOCATION 2013 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 LOCATION 2013 REVENUES 2013 2202 B395 MATERIALI 2013 3304 LOCATION 2013 REVENUES 2013 2202 B395 MATERIALI 2013 3304 LOCATION 2013 REVENUES 2013 2202 B395 MATERIALI 2013 3304 LOCATION 2013 REVENUES 2013 2202 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 B.U. 2013 1002 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 B.U. 2013 1002 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 B.U. 2013 1002 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 B.U. 2013 1002 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 LOCATION 2013 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 LOCATION 2013 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 LOCATION 2013 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 LOCATION 2013 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 REVENUES 2013 2202 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 REVENUES 2013 2202 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 REVENUES 2013 2202 B395 MATERIALI 2013 3304 MATERIALI 2013 3304 REVENUES 2013 2202 B395 MATERIALI 2013 3304 REVENUES 2013 2202 B.U. 2013 1002 B395 MATERIALI 2013 3304 REVENUES 2013 2202 B.U. 2013 1002 B395 MATERIALI 2013 3304 REVENUES 2013 2202 B.U. 2013 1002 B395 MATERIALI 2013 3304 REVENUES 2013 2202 B.U. 2013 1002 B395 MATERIALI 2013 3304 REVENUES 2013 2202 LOCATION 2013 B395 MATERIALI 2013 3304 REVENUES 2013 2202 LOCATION 2013 B395 MATERIALI 2013 3304 REVENUES 2013 2202 LOCATION 2013 B395 MATERIALI 2013 3304 REVENUES 2013 2202 LOCATION 2013 B395 MATERIALI 2013 3304 REVENUES 2013 2202 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 REVENUES 2013 2202 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 REVENUES 2013 2202 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 REVENUES 2013 2202 MATERIALI 2013 3304 B395 MATERIALI 2013 3304 REVENUES 2013 2202 REVENUES 2013 2202 B395 MATERIALI 2013 3304 REVENUES 2013 2202 REVENUES 2013 2202 B395 MATERIALI 2013 3304 REVENUES 2013 2202 REVENUES 2013 2202 B395 MATERIALI 2013 3304 REVENUES 2013 2202 REVENUES 2013 2202 B395 REVENUES 2013 2202 B.U. 2013 1002 B.U. 2013 1002 B395 REVENUES 2013 2202 B.U. 2013 1002 B.U. 2013 1002 B395 REVENUES 2013 2202 B.U. 2013 1002 B.U. 2013 1002 B395 REVENUES 2013 2202 B.U. 2013 1002 B.U. 2013 1002 B395 REVENUES 2013 2202 B.U. 2013 1002 LOCATION 2013 B395 REVENUES 2013 2202 B.U. 2013 1002 LOCATION 2013 B395 REVENUES 2013 2202 B.U. 2013 1002 LOCATION 2013 B395 REVENUES 2013 2202 B.U. 2013 1002 LOCATION 2013 B395 REVENUES 2013 2202 B.U. 2013 1002 MATERIALI 2013 3304 B395 REVENUES 2013 2202 B.U. 2013 1002 MATERIALI 2013 3304 B395 REVENUES 2013 2202 B.U. 2013 1002 MATERIALI 2013 3304 B395 REVENUES 2013 2202 B.U. 2013 1002 MATERIALI 2013 3304 B395 REVENUES 2013 2202 B.U. 2013 1002 REVENUES 2013 2202 B395 REVENUES 2013 2202 B.U. 2013 1002 REVENUES 2013 2202 B395 REVENUES 2013 2202 B.U. 2013 1002 REVENUES 2013 2202 B395 REVENUES 2013 2202 B.U. 2013 1002 REVENUES 2013 2202 B395 REVENUES 2013 2202 LOCATION 2013 B.U. 2013 1002 B395 REVENUES 2013 2202 LOCATION 2013 B.U. 2013 1002 B395 REVENUES 2013 2202 LOCATION 2013 B.U. 2013 1002 B395 REVENUES 2013 2202 LOCATION 2013 B.U. 2013 1002 B395 REVENUES 2013 2202 LOCATION 2013 LOCATION 2013 B395 REVENUES 2013 2202 LOCATION 2013 LOCATION 2013 B395 REVENUES 2013 2202 LOCATION 2013 LOCATION 2013 B395 REVENUES 2013 2202 LOCATION 2013 LOCATION 2013 B395 REVENUES 2013 2202 LOCATION 2013 MATERIALI 2013 3304 B395 REVENUES 2013 2202 LOCATION 2013 MATERIALI 2013 3304 B395 REVENUES 2013 2202 LOCATION 2013 MATERIALI 2013 3304 B395 REVENUES 2013 2202 LOCATION 2013 MATERIALI 2013 3304 B395 REVENUES 2013 2202 LOCATION 2013 REVENUES 2013 2202 B395 REVENUES 2013 2202 LOCATION 2013 REVENUES 2013 2202 B395 REVENUES 2013 2202 LOCATION 2013 REVENUES 2013 2202 B395 REVENUES 2013 2202 LOCATION 2013 REVENUES 2013 2202 B395 REVENUES 2013 2202 MATERIALI 2013 3304 B.U. 2013 1002 B395 REVENUES 2013 2202 MATERIALI 2013 3304 B.U. 2013 1002 B395 REVENUES 2013 2202 MATERIALI 2013 3304 B.U. 2013 1002 B395 REVENUES 2013 2202 MATERIALI 2013 3304 B.U. 2013 1002 B395 REVENUES 2013 2202 MATERIALI 2013 3304 LOCATION 2013 B395 REVENUES 2013 2202 MATERIALI 2013 3304 LOCATION 2013 B395 REVENUES 2013 2202 MATERIALI 2013 3304 LOCATION 2013 B395 REVENUES 2013 2202 MATERIALI 2013 3304 LOCATION 2013 B395 REVENUES 2013 2202 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 REVENUES 2013 2202 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 REVENUES 2013 2202 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 REVENUES 2013 2202 MATERIALI 2013 3304 MATERIALI 2013 3304 B395 REVENUES 2013 2202 MATERIALI 2013 3304 REVENUES 2013 2202 B395 REVENUES 2013 2202 MATERIALI 2013 3304 REVENUES 2013 2202 B395 REVENUES 2013 2202 MATERIALI 2013 3304 REVENUES 2013 2202 B395 REVENUES 2013 2202 MATERIALI 2013 3304 REVENUES 2013 2202 B395 REVENUES 2013 2202 REVENUES 2013 2202 B.U. 2013 1002 B395 REVENUES 2013 2202 REVENUES 2013 2202 B.U. 2013 1002 B395 REVENUES 2013 2202 REVENUES 2013 2202 B.U. 2013 1002 B395 REVENUES 2013 2202 REVENUES 2013 2202 B.U. 2013 1002 B395 REVENUES 2013 2202 REVENUES 2013 2202 LOCATION 2013 B395 REVENUES 2013 2202 REVENUES 2013 2202 LOCATION 2013 B395 REVENUES 2013 2202 REVENUES 2013 2202 LOCATION 2013 B395 REVENUES 2013 2202 REVENUES 2013 2202 LOCATION 2013 B395 REVENUES 2013 2202 REVENUES 2013 2202 MATERIALI 2013 3304 B395 REVENUES 2013 2202 REVENUES 2013 2202 MATERIALI 2013 3304 B395 REVENUES 2013 2202 REVENUES 2013 2202 MATERIALI 2013 3304 B395 REVENUES 2013 2202 REVENUES 2013 2202 MATERIALI 2013 3304 B395 REVENUES 2013 2202 REVENUES 2013 2202 REVENUES 2013 2202 B395 REVENUES 2013 2202 REVENUES 2013 2202 REVENUES 2013 2202 B395 REVENUES 2013 2202 REVENUES 2013 2202 REVENUES 2013 2202 B395 REVENUES 2013 2202 REVENUES 2013 2202 REVENUES 2013 2202
查询
SELECT
[field 1] = bu.[No_]
,[field 2] = bu.[Dimension Code] + ' ' + bu.[Dimension Value Code]
,[field 4] = mat.[Dimension Code] + ' ' + mat.[Dimension Value Code]
,[field 5] = rev.[Dimension Code] + ' ' + rev.[Dimension Value Code]
FROM
dbo.[Zoom InProgress$Default Dimension] bu
LEFT JOIN dbo.[Zoom InProgress$Default Dimension] loc ON loc.[No_] = bu.[No_]
LEFT JOIN dbo.[Zoom InProgress$Default Dimension] mat ON mat.[No_] = bu.[No_]
LEFT JOIN dbo.[Zoom InProgress$Default Dimension] rev ON rev.[No_] = bu.[No_