Skip to the content ForoHackers
Log inJoin

I tried to split the affiliations and one paper lost its only author

Data engineeringSQL
#22547 · · Quote · Report

One paper in my tiny fixture has authors K and M. K has two affiliations and M has none. After the migration there are still two export rows, which looks perfect until both rows answer to K. What would you count before giving me my very small parade?

#22565 · · Quote · Report

Count the authors for that paper, not the affiliations. In the joined output COUNT(DISTINCT author_id) is one. I'd want to see M even if the next column is empty.

#22566 · · Quote · Report

@mayo63 Switched the affiliation join to a left join. Now K turns up twice and M once with a NULL affiliation. Three rows, two authors, both correct. Parade reduced to three uneven pencil marks.

#22567 · · Quote · Report

En moenie COUNT(*) vir die getal affiliasies gebruik nie. M se leë plek gee jou nog 'n ry. Tel die affiliasiekolom self as jy die twee werklike verbintenisse soek.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply