473,395 Members | 1,872 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,395 software developers and data experts.

getting my inner join to work

I have a book catalog where some books have more than one author, hence
I've made a one-to-many table where I have the book isbn matched up to
the author id.

I have a table called books that has the book title, etc. and an author
table that has the author info. I join these to on the book_to_author
table that has two columns, the isbn and the author id, where they match
up.

Now I want to do a search that pulls up all the titles written by one
author, so that if someone sees a book they like on our site, and they
want to pull up all the titles by that author, they click on the authors
name and all the titles they have written now appear on a scroll out
page.

I'm confused about how to write the join statements given the three
tables. So how would I write this?

Thanks for your help,

Bill

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 1625

"Bill" <Bi***********@gospellight.com> wrote in message
news:3f***********************@news.frii.net...
I have a book catalog where some books have more than one author, hence
I've made a one-to-many table where I have the book isbn matched up to
the author id.

I have a table called books that has the book title, etc. and an author
table that has the author info. I join these to on the book_to_author
table that has two columns, the isbn and the author id, where they match
up.

Now I want to do a search that pulls up all the titles written by one
author, so that if someone sees a book they like on our site, and they
want to pull up all the titles by that author, they click on the authors
name and all the titles they have written now appear on a scroll out
page.

I'm confused about how to write the join statements given the three
tables. So how would I write this?

Thanks for your help,

Bill

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


It would be helpful to have the DDL (CREATE TABLE) statements for your
tables, but I guess you're looking for something along these lines:

select
b.title
from
dbo.books b
join dbo.book_to_author ba
on b.isbn = ba.isbn

join dbo.authors a
on ba.author_id = a.author_id
where
a.author_id = ?????

Simon
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: middletree | last post by:
I've seen posts here and elsewhere which read something along the lines of "PULLNG MY HAIR OUT!!!!!" or "HELLLLPPP!". Well, I know that kind of subject line isn't descriptive, but I sure can...
3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
2
by: sjoshi | last post by:
I'm trying this simple query but getting multiple listings for change_number field SELECT c.Change_Number, c.Submission_Date, c.Short_Description, c.CurrentStatus, dlv.Name, s.Description,...
15
by: U N Me | last post by:
I have a continuous form that lists records from a query. One of the columns is an amount field, In the footer of the form I place a text box that displays the total (sum) of the amount. The...
2
by: JimJim | last post by:
Wondering if someone here could help me out, I've tried a number of ways to do this, and while I have managed to get it to work, Im SURE im not doing the optimal way, and it seems to be causing...
0
by: rpisaneschi | last post by:
Can anyone figure out why I am getting the SQL 203 below ? SELECT DISTINCT SP.SPCLT_CD, CASE CI.CORP_ENT_CD WHEN 'IL1' THEN ' ' ELSE SP.PROV_TYP_CD END AS XPROV_TYP_CD, ST.PWN_STA_CD...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
3
by: Zeff | last post by:
Hi all, I have a relational database, where all info is kept in separate tables and just the id's from those tables are stored in one central table (tblMaster)... I want to perform a query, so...
4
by: shapper | last post by:
Hello, I have 2 tables: Aid, Aname ... Bid, Aid, Bname ... I need to get the records in B given a Bname and a Aname. I think I should use Inner Join. I wrote the following code:
1
by: Phil Stanton | last post by:
I am trying to make sense of the Sage Line 50 accounts package through Access 2k I have linked the tables and they appear OK The following query runs OK SELECT AUDIT_JOURNAL.NOMINAL_CODE,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.