I have 2 tables:
- TOPICS (id, title)
- ANSWERS (id,
id_topic,id_user, answer)
…and i want to do a select to detect all the questions belonging to a user in one select.
I tried to do a join, but that doesn’t work since if a user answered a topic twice, it will return 2 rows with the same topic. I tried to do a SELECT DISTINCT, but that fails also.
Try:
…or:
…and test for performance according to your indexing regimen. Recent versions of MySQL only.