I have this table shown below...How do I select only the latest data of the id based on changeno?
+----+--------------+------------+--------+ | id | data | ch
You want to use row_number() for this:
row_number()
select id, data, changeno from (SELECT t.*, row_number() over (partition by id order by changeno desc) as seqnum FROM Table1 t ) t where seqnum = 1;