mysql - Join two tables with condition on the first table -
i want make these 2 1 select statement:
select * activegroupmodel groupid = ? order groupmodelid desc limit 1 select * model modelid = ?
as can see first groupid not pk , want latest model table. i'v tried didn't work:
select * activegroupmodel a.groupid = ? order a.groupmodelid desc limit 1 inner join model m on a.modelid = m.modelid
i've read bunch of questions join none of them matches problem. knows how can solve this? best regards johan
just put join before condition, this:
select * activegroupmodel inner join model m on a.modelid = m.modelid a.groupid = ? order a.groupmodelid desc limit 1
Comments
Post a Comment