Combination of the fields from the 2 tables below:
Master
------
A_ID (PK)
SYSSerialNumber
logtime
FileName
SYSTEM (Master:SYSTEM -1:1)
------
SYS_ID
A_ID (FK)
Version
Combined Result:
SerialNumber logtime Filename Version
CZJ 23 ABC.txt 1.02
CZJ 234 ABC.txt 1.02
CZJ 123 ABC.txt 1.1
CZJ 2343 CDE.txt 1.05
CZJ 24343 CDE.txt 1.05
RXZ 343 HP.txt 1.1
RXZ 4232 HP.txt 1.1
RXZ 2424 HP_1.txt 1.1
RXZ 2424 HP_1.txt 1.1
XYZ 3345 MNO.txt 1.05
XYZ 34634 MNO.txt 1.1
XYZ 45 MNO.txt 1.03
XYZ 3463 MNO.txt 1.02
My Required result: File names that have ONLY 1.1 version and no other
The filenames displayed would be HP.txt and HP_1.txt
select A.SerialNumber, A.logtime, Version,
A.AHS_FILENAME
from MASTER A, SYSTEM B,
(SELECT dd.A_ID, FILENAME, COUNT(DISTINCT
EE.Version) version_count
FROM MASTER DD, SYSTEM EE
WHERE DD.A_ID = EE.A_ID
GROUP BY dd.A_ID, dd.A_FILENAME) C
where A.A_ID = B.A_ID
and A.A_ID = C.A_ID
and A.FILENAME = C.FILENAME
and B.Version='1.1'
and C.version_count = 1
But I get the filenames with other versions included along with 1.1
Would appreciate any help.