473,320 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Lookup table

Hello,

I have searched the forum for related problems, though I have found a few, I was unable to apply them to my database. So here it goes:

This is a n:m relationship.
Three tables: author, speech, speech_author.
Table author: the usual stuff, with no column linking to speech or speech_author.
Table speech: same as above.
Table speech_author: this is the look-up table that has the author_id and speech_id.

The result I need is a list of speeches with the author name next to it. I.E.:
author_name, speech_title.

If there are authors that do not have speeches, then the author should be omitted. This basically is a list of speeches.

I have tried applying JOIN, INNER JOIN, OUTER JOIN, NATURAL JOIN, but kind of have no idea how to organize them. I am reading several MySQL books, but none of them seems to show queries for look-up tables.

Thanks!
Aug 4 '08 #1
4 1850
r035198x
13,262 8TB
Your select should be on speech_author left join the other two tables.
Aug 5 '08 #2
Your select should be on speech_author left join the other two tables.
I've tried:
SELECT *
FROM speech_author
LEFT JOIN speech, author
The result is the following:
Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' author' at line 3
You can try out the queries at: SQL Query Send. I've made the backups.
Aug 5 '08 #3
r035198x
13,262 8TB
I've tried:
SELECT *
FROM speech_author
LEFT JOIN speech, author
The result is the following:
Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' author' at line 3
You can try out the queries at: SQL Query Send. I've made the backups.
That's just incorrect syntax.
You probably meant
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM speech_author sa
  3. LEFT JOIN speech s ON ( /*link your ids here*/) 
  4. LEFT JOIN author a ON ( /*link your ids here*/)
Always use the manual to get the correct syntax.
Aug 5 '08 #4
Hey,

I've tried:
SELECT *
FROM speech_author AS sa
LEFT JOIN author AS a ON (a.author_id)
LEFT JOIN speech AS s ON (s.speech_id)
Result:
Error 2008: MySQL client ran out of memory
If you don't mind, could you try out the query at Query Test?

Really appreciate the help.

BTW: Could anyone suggest a book or site where I can read more about this? I'm only able to find one:many and one:one relationships, but not for many:many relationships.
Aug 7 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: John Collyer | last post by:
Hi, In assembly language you can use a lookup table to call functions. 1. Lookup function address in table 2. Call the function Like: CALL FUNCTION
1
by: James E | last post by:
I have a question about best practices of how to deal with lookup data from my C# apps. On a couple of occasions I have come across a problem where I have to automate inserting a record into a...
9
by: Koen | last post by:
Hi all, My application uses a lot of lookup tables. I've splitted the frontend (forms, reports, etc) from the backend (data). The database has around 10 different users. The values in the...
3
by: my-wings | last post by:
I've been reading about how evil Lookup fields in tables are, but I've got to be missing something really basic. I know this subject has been covered before, because I've just spent an hour or two...
1
by: Zachary Turner | last post by:
I want to make a Lookup Field based on another Lookup field. In other words, I have this table A with two fields: ID and Name, where ID is an Autonumber and Name is a friendly name. Then I have a...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
1
by: Paul H | last post by:
Say I have a table called tblPeopleInfo, one of the fields in the table is called FavouriteFruit. The FavouriteFruit field is a lookup field and will contain Apples, Oranges, Grapes etc..The list...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
3
by: dbuchanan | last post by:
Hello, (Windows forms - SQL Server) I fill my datagrid with a stored procedure that includes relationships to lookup tables so that users can see the values of the combobox selections rather...
0
by: =?Utf-8?B?RU1hbm5pbmc=?= | last post by:
(I originally posted this to the data access newsgroup but received no replies) I've got an Access 2003 mdb that I'm converting to VB.Net. I'm having trouble with getting the main data source to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.