MySQL Forums
Forum List  »  General

Re: cross joining 3 tables
Posted by: Dimitris Papageorgiou
Date: September 08, 2015 04:08AM

Peter Brawley Wrote:
-------------------------------------------------------
> A Cross Join is not just a join across
> multiple tables. It's a join that deliberately
> omits key specification, so it returns all
> logically possible combinations of rows from the
> joined tables.

Got it!!!

> Adopt a convention about underscores in the names
> of columns that end with ID, then stick to your
> convention, otherwise you condemn yourself and
> whoever else has to work with your database to
> endless typo corrections.

I assume you are referring to the fact that...I have user_ID,type_ID...and then crID...

> If business_users send or receive packages, the
> relationship is probably one-many rather than
> many-one, in which case packages would need a
> foreign key into business_users, rather than the
> other way round.

The business users do not send/receive packages...these are payments packages to which a user is subscribed to.

> Your spec is for an ordinary Inner Join; is this
> what you mean?
>
> select u.name,u.lastname,t.user_type
> from users u
> join business_users b on u.user_id=b.crid
> join buz_usertype t on b.bus_user_type=t.type_id
> where u.lastname like 'Doe%';

Yes...thanks...it works in the IDE console...in the PHP id script does not work...but I will make a separate post for that.

Options: ReplyQuote


Subject
Written By
Posted
September 07, 2015 07:37AM
September 07, 2015 12:20PM
Re: cross joining 3 tables
September 08, 2015 04:08AM
September 16, 2015 10:55AM


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.