Query to get data in one status not in another status I have a table with status column with different status values like 'A','C','E','I'. My data is like this:

----------------------------------------------
TagNo   TruckNo     VerifiedDateTime    Status
----------------------------------------------
4489    AP03X3153   25-02-2015 17:23:00   A
4489    AP03X3153   25-02-2015 21:12:00   C
6135    AP04TU1422  08-04-2015 15:34:00   C
6135    AP04TU1422  07-04-2015 20:25:00   A
2742    AP07TU0471  05-09-2014 15:38:00   A
2708    AP07TU7495  01-04-2014 14:13:00   A
2708    AP07TU7495  01-04-2014 17:11:00   C
4021    AP16TV1916  22-04-2015 12:49:00   A
4338    AP16TX1928  22-04-2015 13:22:00   A
2615    AP16TY9672  10-07-2014 13:50:00   A
2615    AP16TY9672  10-07-2014 20:17:00   C
2615    AP16TY9672  25-06-2014 20:50:00   A
2615    AP16TY9672  26-06-2014 01:32:00   C
3431    AP21W6856   06-05-2014 17:53:00   A
3431    AP21W6856   06-05-2014 21:06:00   C
728     AP21X6303   08-12-2014 17:24:00   A
728     AP21X6303   08-12-2014 19:31:00   C
2660    AP24TA5436  18-09-2014 22:17:00   A
2104    AP24TB0108  15-04-2014 15:27:00   A
2104    AP24TB0108  15-04-2014 16:08:03   E
2104    AP24TB0108  15-04-2014 19:28:00   C
----------------------------------------------


I want data with status 'A' and not in any other status. For example: TruckNo 'AP03X3153' with two status 'A' and 'C' I don't want to display this record 
similarly TruckNo 'AP04TU1422' has only one status 'A' I want to display this record.

----------------------------------------------
TagNo   TruckNo     VerifiedDateTime    Status
----------------------------------------------
6135    AP04TU1422  07-04-2015 20:25:00   A
2742    AP07TU0471  05-09-2014 15:38:00   A
4021    AP16TV1916  22-04-2015 12:49:00   A
4338    AP16TX1928  22-04-2015 13:22:00   A
2660    AP24TA5436  18-09-2014 22:17:00   A
----------------------------------------------
So if I understand correctly, you want the latest status and be able to filter on it. I don't know what version of SQL Server you're using but APPLY has been out since 2005 so try this out:

SELECT  DISTINCT TagNo,
        TruckNo,
        CA.VerifiedDateTime,
        CA.Status
FROM yourTable A
CROSS APPLY 
(
    SELECT TOP 1 VerifiedDateTime,Status 
    FROM yourTable 
    WHERE TagNo = A.TagNo 
    ORDER BY VerifiedDateTime DESC
) CA
WHERE CA.Status = 'A';