在Teradata上编写JOIN命令

时间:2016-06-27 18:58:10

标签: inner-join teradata

q)使用COUNT和DISTINCT确定有多少不同的skus 在skuinfo,skstinfo和trnsact表中。哪些skus对所有表都是通用的,或者对于特定表是唯一的?

A)我试图在 TERADATA 中找到上述q的解决方案。第一部分很简单我能够运行三个命令并得到了明显的skus(库存单位)。

现在在所有三个表中找到常见的sku我正在运行命令但是有错误:

SELECT COUNT(DISTINCT a.sku),COUNT(DISTINCT b.sku),COUNT(DISTINCT c.sku)
FROM skuinfo a INNER JOIN skstinfo b INNER JOIN trnsact c
ON a.sku=b.sku AND b.sku=c.sku;// Why is there error if i use **Where** in Place of ON?
**Error Occurred . . .**
[com.teradata.commons.datatools.sqlparsers.common.ParseException: Encountered ";" at line 3, column 31. Was expecting one of: "and" ... "at" ... "cross" ... "day" ... "full" ... "hour" ... "inner" ... "join" ... "left" ... "minute" ... "month" ... "on" ... "or" ... "right" ... "second" ... "timezone_hour" ... "timezone_minute" ... "year" ... "||" ... "(" ... "**" ... "+" ... "-" ... "*" ... "/" ... "mod" ... "." ... "[" ... ]

请告诉我为什么我的语法不起作用,尽管大多数论坛都说查询是正确的。感谢

0 个答案:

没有答案