mysql - SQL Join over two tables -
here problem:
i have 2 tables. every entry of table has several entries in table b matched on id. want entries of table 1 data entry of table b - 1 highest id in table.
table has id
table b has own id , id_of_table_a (for relation between both)
table has 1 many relation table b. want entries of table a, matched 1 highest id out of b. there way realize in sql statement? tried kinds of joins since need information of matched entry in outcome of select.
how about
select * tablea inner join tableb b on a.id = b.id_of_table_a b.id = (select max(id) tableb c b.id = c.id)
Comments
Post a Comment