mysql - Using a nested query to get details of two tables -
table 1 table 2 id name mob id course mark 1 joe 0000 1 english 77 2 john 0000 2 maths 89
i need show name of person table 1 has max(grade) in table 2 using nested query.
select t1.name t1 t1.id = t2.id = ( select id t2 mark = ( select max(mark) t2 ) );
well, satisfies brief ;-):
select a.* table_a join (select * table_b) b on b.id = a.id order mark desc limit 1;
Comments
Post a Comment