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.
I tried:
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).
average value for a country indicates that you need a group by on the country.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
Why do you think that? I thought the isue was that you were getting multiple reos so it sounds like it doesn't.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.