sql server - SQL, get max id of column -


i've got table in ms sql server management studio

+------+-----------+-------- | id   | client id | bla bla blaaaa +------+-----------+-------- |    1 |   1       | ....... |    2 |   2       | ....... |    3 |   3       | ....... |    4 |   8       | ....... |    5 |   9       | ....... |    6 |   15      | ....... |    7 |   1       | ....... |    8 |   16      | ....... |    9 |   2       | ....... |   10 |   9       | ....... |   12 |   12      | ....... +------+-----------+-------- 

i need unique [client id] max value of [id], this

+------+-----------+-------- | id   | client id | bla bla blaaaa +------+-----------+-------- |    3 |   3       | ....... |    4 |   8       | ....... |    6 |   15      | ....... |    7 |   1       | ....... |    8 |   16      | ....... |    9 |   2       | ....... |   10 |   9       | ....... |   12 |   12      | ....... +------+-----------+-------- 

i tried code, doesn't work .. can me?

select *   table 1  inner join table 2    on one.[client id] = two.[client id]    one.[id] > two.[id] 

select max(id), client_id, blah_blah my_table group client_id, blah_blah 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -