Skip to content
Advertisement

Write a select query that displays “id” if a different “id” has same “panum”

The question i need to answer:

“Display a list of academics that have collaborated with another academic on more than one paper. List individual pairs of academics on each line. List only their academic numbers. Do not list duplicate pairs. (e.g 56,113 and 113,56 are duplicate pairs)”

So far iv been looking a way to write a query that displays duplicate “panum”(paper number) but i cant find anything online, not really sure what to search for to be honest

Some useful information:

if we use the sample data as example. it should output the acnum of those that have worked on the same paper together.

Advertisement

Answer

You need a self join of the table AUTHOR, GROUP BY the pair of academics from each copy of the table and set the condition in the HAVING clause:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement