How to merge three MySQL tables and delete certain rows?

There are three tables:
1. Table Sciences
2. Table with known science
3. Table indicates what science opens after the study of a specific.

Sciences can be over 500 so I don't want the time to display all the science, and it makes no sense. You should print only those which are possible to explore and hide studied.

In my case, studied Agriculture and animal Husbandry. They opened access to: Milk, meat, wheel, iron.
Machine and the Rocket is unavailable. They need to hide.

Two days trying to do that using JOINS s. It is nonsense. Please tell me how to implement it?


April 19th 20 at 12:40
1 answer
April 19th 20 at 12:42
What can I do for two days?
SELECT `s`.*
 FROM `learned_sciences` AS `l`
 JOIN `science_branch` AS `b` ON `b`.`science_id` = `l`.`science_id`
 JOIN `sciences` AS `s` ON `s`.`id` = `b`.`open_science_id`
 WHERE `l`user_id` = :iserId
 AND `s`.`id` NOT IN (
 SELECT `science_id`
 FROM `learned_sciences`
 WHERE `user_id` = :userId
I've been slow with NOT IN. Thank you )) - sandy_Lynch commented on April 19th 20 at 12:45
Noticed inconsistencies. Added studied the Wheel and I opened the Car. However, to unlock cars need the wheel And Iron. Is it possible to sharpen a request under the solution to this problem or need in the script to make an amendment? - sandy_Lynch commented on April 19th 20 at 12:48

Find more questions by tags MySQL