Reputation: 600
I want to ask something.
Here's the table:
A_ID B_ID C_ID Version E_ID F_ID
1009 2882000 mi7 1 200 01.mi7.LBUS.BSMS5.1360062644
1009 2882000 mi7 1 200 02.mi7.LBUS.BSMS5.1360062656
1009 2882000 mi7 1 -130 03.mi7.LBUS.BSMS5.1360062670
1009 2882000 mi7 2 200 01.mi7.LBUS.BSMS5.1360062681
1009 2882000 mi7 2 200 02.mi7.LBUS.BSMS5.1360062689
I want to get the all value of E_ID and F_ID from table which is newest version refer to version column, the version column will be increase refer to other process and I want always get the newest value
i want the output is :
Version E_ID F_ID
2 200 01.mi7.LBUS.BSMS5.1360062681
2 200 02.mi7.LBUS.BSMS5.1360062689
What should I do?
Upvotes: 0
Views: 62
Reputation: 116498
Try:
SELECT E_ID, F_ID
FROM [the table]
WHERE [Version] = (SELECT MAX([Version]) FROM [the table])
This will return all rows with Version = 2 in your case.
Upvotes: 1