I need some help with a query on a database with MySQL version 3.23.58.
In principle I wanted to do this query (with some php included):
SELECT *
FROM abstracts
LEFT JOIN
(SELECT * FROM reviewdata WHERE reviewerid='$userid') as reviewdata
ON abstracts.id=reviewdata.abstractid
WHERE session='$session'
In words, I want a list with all abstracts combined with reviewdata for the abstracts if the reviewer already has reviewed it. Otherwise I still want the abstract but with empty reviewdata (so that he can change it).
The above query works fine in the newer versions but in this old version I’m not allowed to use subqueries, so MySQL complains when I use the nested SELECT in the LEFT JOIN.
So now I’m looking for a way to avoid this subquery…
I tried:
SELECT *
FROM abstracts
LEFT JOIN reviewdata
ON abstracts.id=reviewdata.abstractid
WHERE session='$session' AND (reviewerid='$userid' or reviewerid is null)
But this results in that abstracts reviewed by other reviewers, but not by this specific reviewer, are not shown for him at all.
My problem is that I don’t know what was allowed back then…
Without an old installation I can’t try this, but try putting the check for the reviewerid in the ON clause.