I've created a custom SQL table with a CustomerID, OrderID, OrderDate, a rank called RankKey, and a join key that is (CustomerID + RankKey). For some reason, the output for the join key uses a different CustomerID from the CustomerID in its own row! Why would a CustomerID of ALFKI give a join key that uses CustomerID GREAL ?? (code below and output attached)
Any help would be greatly appreciated! Thanks so much!
SELECT o.CustomerID, o.OrderID, o.OrderDate,
RANKASC(o.CustomerID, o.OrderDate) AS RankKey,
CONCAT(toString(RANKASC(o.CustomerID, o.OrderDate)), o.CustomerID) AS JoinKey2
FROM Orders AS o
ORDER BY o.CustomerID, o.OrderDate
Please sign in to leave a comment.