Jeg kan mere lide en anden tilgang beskrevet i et lignende spørgsmål:https://stackoverflow.com/a/11885521/ 2215679
Denne tilgang er bedre, især hvis du har brug for at vise mere end ét felt i SELECT. For at undgå Error Code: 1241. Operand should contain 1 column(s)
eller dobbelt undervælg for hver kolonne.
For din situation skal forespørgslen se sådan ud:
SELECT
c.id,
c.title,
p.id AS product_id,
p.title AS product_title
FROM categories AS c
JOIN products AS p ON
p.id = ( --- the PRIMARY KEY
SELECT p1.id FROM products AS p1
WHERE c.id=p1.category_id
ORDER BY p1.id LIMIT 1
)