What i did is-
1: Changed my table creation query and used DATETIME in place of DATE
CREATE TABLE EDATA
(
ID INT not null,
Name NVARCHAR(50)not null,
TDate
DATETIME not null,
TCard INT not null
);
2:
and then simply query is working without using CAST function, as
SELECT
MaxDate,
MinDate,
DATEDIFF(D, MaxDate, MinDate)
FROM (
SELECT
MAX(TDate) AS MaxDate,
MIN(TDate) AS MinDate
FROM EDATA
GROUP BY TCard
)a