I'm a newb. This is probably an easy fix.
Query:
select AvgR.preavgMR - AvgR.postavgMR
from (
((select R.mID mID, avg(R.stars) preavgMR from Rating R group by R.mID)
join Movie M using (mID)
where year < 1980
)
join
((select R.mID mID, avg(R.stars) postavgMR from Rating R group by R.mID)
join Movie M using (mID)
where year >= 1980
)
) AvgR using (mID);
Result:
Query failed to execute: near "where": syntax error
Ideas/suggestions? Thanks!
Try this way:
select AvgR.preavgMR - AvgR.postavgMR
from (
(
select mID,preavgMR
from (select R.mID mID, avg(R.stars) preavgMR from Rating R group by R.mID) T1
join Movie M using (mID)
where year < 1980
)
join
(
select mID,postavgMR
from (select R.mID mID, avg(R.stars) postavgMR from Rating R group by R.mID) T2
join Movie M using (mID)
where year >= 1980
)
) AvgR;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.