Please give me at least hint what may be wrong in this query to ex.32:
One of characteristics of a ship is one-half cube of calibre of its main guns (mw). Within 2 decimal places, define the average value of mw for the ships of each country which has ships in database.
SELECT DISTINCT Classes.country, convert(decimal(14,2), ( SELECT AVG( pen.p ) FROM ( SELECT (c1.bore*c1.bore*c1.bore)/2 AS p FROM Classes AS c1, Ships AS s1 WHERE c1.class=s1.class AND c1.country = Classes.country UNION ALL SELECT (c2.bore*c2.bore*c2.bore)/2 FROM Classes AS c2, (select distinct ship from Outcomes) as o2 WHERE c2.country = Classes.country AND c2.class=o2.ship AND o2.ship NOT IN ( SELECT ss.name FROM Ships AS ss ) ) AS pen WHERE pen.p IS NOT NULL )) AS weight FROM Classes WHERE Classes.country IS NOT NULL
However this query produces one more record than expected (on second DB).