Jump to content

Archived

This topic is now archived and is closed to further replies.

jackyji

i want to get the record of each model where the code is minimum?

Recommended Posts

there is a table:
code model remark
1 a x
2 a x
3 a x
4 b z
5 b z
6 c y
7 c y
8 c y

i want to get the record of each model where the code is minimum.
the result is:
code model remark
1 a x
4 b z
6 c y
how can i write the sql?

Share this post


Link to post
Share on other sites
select code, model, remark from tablename group by model order by code;

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.