I have row table like this :
ID EQ TI LE VAL NO
==================================
1504 TX 410413 Y 2065000 1
1504 TX 410413 Y 2065000 2
1504 TX 410413 Y 2065000 3
1504 TX 410413 Y 730000 4
1504 TX 410413 C 2606900 5
1504 TX 410413 Y 4120900 6
1504 TX 410413 Y 4120900 7
1504 TX 410413 Y 2065000 8
1504 TX 410413 Y 2065000 9
1503 TX 410413 Y 2065000 1
1503 TX 410413 Y 2065000 2
1503 TX 410413 Y 2065000 3
1503 TX 410413 Y 2065000 4
1503 TX 410413 C 2606900 5
1503 TX 410413 Y 4120900 6
1503 TX 410413 Y 4120900 7
1503 TX 410413 Y 2065000 8
1503 TX 410413 Y 2065000 9
What i want to ask is, how to display rows only with the latest id (1504). The situation is i dont know the latest id so, query like select * from ... where id LIKE '1504' is not i want to use.
Please give me any advice query how to solve this.
Try
Select * from yourtable where id=(select max(id) from yourtable)
You can use in if you want to display multiple ids.