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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -