MySQL Forums
Forum List  »  Newbie

Beginner SQL question
Posted by: King Kong
Date: May 29, 2014 08:13PM

Dear all,
I am a real new beginner and hence, can't solve certain questions arising to me in the task to learn more.
I have a table with the following structure
id---Name---Country_ID---First1_ID---First2_ID---First3_ID....
Example
1---Smith---1---3---1---4---2
2---Haydn---3---2---4---5---1
So besides id and name, all other field contents are referring to another table which looks like this
id---Firstname---Country_ID---XXX---YYY
Example
1---Peter---3---Content---House
2---Michael---1---Content---House
3---Clive---2---Content---House
4---XXX
5---YYY
etc.
I would want to have a view which shows the first table but without the IDs with the real content.
Example:
1---Smith---1---Clive---Peter---XXX---Michael
2---Hayd---3---Michael---XXX---YYY---Peter

I just can't get it done.
Can someone help me? I would need this kind of logic elsewhere hence to understand the rationale behind this would be very very helpful in my learning (by example and doing but slowly).
Thanks in advance
Herbert

Options: ReplyQuote


Subject
Written By
Posted
Beginner SQL question
May 29, 2014 08:13PM
May 31, 2014 04:29PM


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.