我正在尝试加入需要转换或强制转换为varchar的列,以匹配不同表中的同一列。但是我在这里尝试的方式得到'<>'的错误无法应用于布尔值,varchar(4),(倒数第二行),其中我在客户id =上加入表c在表c中强制转换了客户ID,有什么办法可以做到?
SELECT e.city,
e.time
m.id,
cast(c.cust_id AS varchar) as customer_id2
FROM
(SELECT *,
rank() OVER (PARTITION BY eid,
e.phase
ORDER BY e.time ASC) rnk
FROM tablea e
WHERE e.day BETWEEN date '2019-05-08' AND date '2019-05-08') e
JOIN tableb m ON e.id = m.id
JOIN tablec c ON m.customer_id = cast(c.cust_id AS varchar)
WHERE rnk = 1 and c.indicator <> 'true'