views:

29

answers:

2

I have a following table

id group name 
1    2    dodo
2    1     sdf
3    2     sd
4    3     dfs
5    3     fda
....

and i want to get intro record from each group like following

id  group name
... 1    sdf
    2    dodo
    3    dfs
...
A: 
select * from table_name where id in (select min(id) from table_name group by group)
Andrew Cooper
A: 
SELECT MIN(id) id, group, name
FROM TABLE1
GROUP BY group
ORDER BY group
sheeks06