I have following Table Structure :
Table: CashStatus (Can have duplicate entries for “ATM”)
ATM Cash Device
A01 55 BASE
A01 1 IST
A02 1 BASE
A02 78 IST
Table : ATM (Unique Entry for ATM Column)
ATM DEVICE
A01 BASE
A02 IST
I want to retreive only those rows from CashStatus table who’s ATM & Device Column matches with as with ATM Table
I did some research and tried the following query:-
SELECT *
FROM CashStatus
WHERE EXISTS (SELECT 'X'
FROM ATM
WHERE ATM = TermId collate SQL_Latin1_General_CP1_CI_AS
AND DeviceName = Devicetype collate SQL_Latin1_General_CP1_CI_AS);
But it gives error : Expression type int is invalid for COLLATE clause.
COLLATE is a keyword used to change language collations for columns; it’s never necessary on numeric datatypes, and probably unnecessary here (since you’re changing from one language to the same language).