I have this query:
SELECT COUNT (DISTINCT CUSTOMER_ACCOUNT.ID) AS NUMBER_OF_ACCOUNTS
FROM CUSTOMER_ACCOUNT
INNER JOIN ACCOUNT ON CUSTOMER_ACCOUNT.ACCOUNT_ID=ACCOUNT.ID
INNER JOIN CUSTOMER_ACCOUNT ON LOAD_ACCOUNT_DETAIL_0.ID = CUSTOMER_ACCOUNT.ID
WHERE Convert(datetime, convert(char(10), [CUSTOMER_ACCOUNT].CREATED_ON, 101)) BETWEEN '2009-01-01' AND '2009-05-1'
AND CUSTOMER_ACCOUNT.DELETED!='1'
AND ACCOUNT.DELETED !='1'and LOAD_ACCOUNT_DETAIL_0.ACCOUNT_STATUS='1'
I get this error:
Msg 1013, Level 16, State 1, Line 1 The objects "CUSTOMER_ACCOUNT" and "CUSTOMER_ACCOUNT" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
Not sure how to solve - any ideas?