连接不同的数据类型

时间:2018-10-03 15:11:06

标签: ms-access types inner-join

我正在尝试对CardID进行内部联接,该联接存在于2个表中:
 PCARDS_ILL_DBO_CARDtExceptionsAll2

PCARDS_ILL_DBO_CARD中,它是一个“数字”;在tExceptionsAll2中,它是一个“短文本”。
我已经查看了Stackoverflow上发布的类似问题的答案并实现了这些问题,但是我仍然遇到错误。

我无法更改PCARDS_ILL_DBO_CARD中的任何格式;不同数据库中的其他几个查询都依靠tExceptionsAll2拥有当前的格式和数据类型。

这就是我所拥有的:

SELECT  tExceptionsAll2.ID
        , tExceptionsAll2.CardholderName
        , PCARDS_ILL_DBO_CARD.PERSON_ID
        , tExceptionsAll2.CardType
        , tExceptionsAll2.Duration
        , tExceptionsAll2.ExceptionType
        , tExceptionsAll2.STL AS [Exp STL]
        , tExceptionsAll2.CL AS [Exp CL]
        , PCARDS_ILL_DBO_CARD.TRANS_LIMIT_AMT AS [Card STL]
        , PCARDS_ILL_DBO_CARD.MONTH_LIMIT_AMT AS [Card CL]
        , tExceptionsAll2.TerminationDate
FROM    PCARDS_ILL_DBO_CARD INNER JOIN tExceptionsAll2 ON (PCARDS_ILL_DBO_CARD.CARD_ID = CAST (tExceptionsAll2.CardID AS INT)) AND 
                                                          (PCARDS_ILL_DBO_CARD.PERSON_ID = tExceptionsAll2.CardholderUIN)
WHERE   (((tExceptionsAll2.STL)>0) AND 
         ((tExceptionsAll2.CL)>0) AND 
         ((PCARDS_ILL_DBO_CARD.TRANS_LIMIT_AMT)<>[tExceptionsAll2].[STL]) AND 
         ((PCARDS_ILL_DBO_CARD.MONTH_LIMIT_AMT)<>[tExceptionsAll2].[CL]) AND 
         ((tExceptionsAll2.TerminationDate) Is Null));

这是错误:

enter image description here

0 个答案:

没有答案