Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 jackyji

jackyji
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 31 May 2006 - 01:03 AM

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?

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 31 May 2006 - 01:21 AM

select code, model, remark from tablename group by model order by code;
Life's too short for arguing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users