mysql - Select 1 row from table where foreign key table records exist -


i've got 2 tables, products , productimages 1 many relationship between products , productimages. i'm trying work query on on products table condition results contain rows matching records in productimages table.

products ---------- id (pk)  productimages --------------- id (pk) product_id (fk products) 

the way can work subquery, surely there must better/more efficient way.

select p.* products p inner join productimages pi on p.id = pi.product_id group p.id 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -