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

Glib GIOChannel -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -

python - Obscure curses error message when creating a sub window -