从另一个表中排序的SQL查询

I have two tables 1st tbl_student and 2nd tbl_hobby

tbl_stundet's columns

  • stdentid
  • studentname

and tbl_hobby columns

  • hobbyid
  • hobby

I want to sort list of tbl_hobyy by studentname ??

You have to join the tables together and the table tbl_hobby must have a column "stundetid" as a foreign key references to the primary key of tbl_stundet "uid"

Select * from tbl_stundet INNER JOIN tbl_hobby on(tbl_stundet.uid = tbl_hobby.stundetid) order by studentname ASC