MySQL Forums
Forum List  »  Newbie

Re: Many to Many using a table in between. Finding combo not recorded.
Posted by: Max Harvey
Date: May 03, 2017 01:25AM

Peter Brawley Wrote:
-------------------------------------------------------
> Homework?
Nope; probably 25 years ago it was, but not these days


> ... and since this is homework, I leave plugging
> these into the above formula up to you, but if you
> get stuck, let's see where.

still stuck (haven't really used much complex sql since uni days, but i came up with a pet project i wanted to do.

So i am able to get all the battles even if there wasn't a match in the battle_generals table

SELECT battle.id, battle_generals.battle_id, battle_generals.generals_id FROM battle
LEFT OUTER JOIN battle_generals
ON battle_generals.battle_id = battle.id

I can get all the generals even if their isn't a match in the battle_generals table

SELECT generals.id, battle_generals.generals_id, battle_generals.battle_id from generals
LEFT OUTER JOIN battle_generals
ON generals.id = battle_generals.generals_id

but i still can't figure out how to combine those two results witch each other.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.