Solved

search authors sql help?

Posted on 2012-03-25
4
301 Views
Last Modified: 2012-03-25
Hi,

I need help with the sql.

I have a tblAuthor(authorid, surname,givenname)
tblAssociation(associationid,publicationid,authorid)
tblPublication(publicationid,title)


I am trying to find all other authors(coauthors) who worked on the same publcation with given an authorid.

ex) coauthors of author1 are 2,3,4,5
      coauthors of author2 are 1,5,7
     coauthors of author3 are 1,4
     coauthors of author4 are 1,3  etc
     
      publication1, author1,author3,author4  
      publciation2, author1,author2,author5
      publication3, author2,author1,author7
      publication4,author6,author7


 tblassociation(1,1,1)
 tblassociation(2,1,3)
 tblassociation(3,1,4)
 tblassociation(4,2,1)
 tblassociation(5,2,2)
 tblassociation(6,2,5)
 tblassociation(7,3,2)
 tblassociation(8,3,1)
 tblassociation(9,3,7)
 tblassociation(10,4,6)
 tblassociation(11,4,7)
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37762609
Select AuthorId
From tblassociation
where pubid in
(Select pubid from tblassociation
Where authorid= [enter author id]
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37762619
I missed a closing parenthesis in that:



Select AuthorId
From tblassociation
where pubid in
(Select pubid from tblassociation
Where authorid= [enter author id])
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37762624
An alternative which might have better performance:


SELECT AuthorId
FROM tblassociation
INNER JOIN
(SELECT pubid FROM tblassociation
WHERE authorid= [enter author id]) AS a
ON tblassociation.PubID = a.PubID
0
 

Author Comment

by:dkim18
ID: 37762632
I think that's what I got.

SELECT Affiliation.AuthorID, Author.Surname, Author.Given_Name
FROM Author INNER JOIN Affiliation ON Author.AuthorID = Affiliation.AuthorID
WHERE (((Affiliation.PublicationID) In (SELECT Affiliation.PublicationID FROM Affiliation WHERE Affiliation.AuthorID=[xxxx])));

Thanks for checking it out.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question