JansenDK Posted January 20, 2010 Share Posted January 20, 2010 Hi all So, im looking for a simple SQL syntax that does following; Determines what subject an article is about. (food, health for axample) I've build 2 entities, one called artikler, and one called emne. http://img163.imageshack.us/img163/3321/illustration.png Now, id like the foreign key from artikler, to refer to the entity emne, so that it can tell what subject that article is. (NOTE, its in danish = entity emne = mad/food and sundhed/health) FK is foreign key. Any ideas for a SQL syntax? Link to comment https://forums.phpfreaks.com/topic/189216-simple-sql-syntax-request/ Share on other sites More sharing options...
fenway Posted January 20, 2010 Share Posted January 20, 2010 What do you have so far? Link to comment https://forums.phpfreaks.com/topic/189216-simple-sql-syntax-request/#findComment-998999 Share on other sites More sharing options...
JansenDK Posted January 20, 2010 Author Share Posted January 20, 2010 Well almost nothing Im brand new to SQL. So, what I got so far is; SELECT emne FROM artikel Im guessing that thats not enough to make any code or action work. Id like the foreign key to fetch the subject of the article. However I dont know how to! http://img96.imageshack.us/img96/4250/illustrationo.png It might be easier to see the relation between foreign key and the primary key of emne. Link to comment https://forums.phpfreaks.com/topic/189216-simple-sql-syntax-request/#findComment-999025 Share on other sites More sharing options...
fenway Posted January 21, 2010 Share Posted January 21, 2010 You'll need to JOIN those tables. Link to comment https://forums.phpfreaks.com/topic/189216-simple-sql-syntax-request/#findComment-999466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.