There is a blood bank which maintains two tables: DONOR that contains information on the people who are willing to donate blood and ACCEPTOR, the people who are in need of blood. The bank wants to conduct a survey and find out the city that has the best and the worst donor sum amount/acceptor sum amount ratio. Both ratios are unique. That is, exactly one city has the best ratio and exactly one city has the worst ratio. The donor sum amount is the total amount of blood, regardless of blood group, that people are ready to donate. The acceptor sum amount is the total amount of blood needed by that city.
There must be exactly two rows that denote the best and the worst ratios. The order of the row does not matter. Each row must contain the following attributes: The say name (CITY). The ratio (donor sum amount/acceptor sum amount ), correct to 4 decimal places.
the schema tables is given below:
These are the two tables
select city, max(d.'abc') from(select CITY, (sum (a. 'amount')/sum (b. amount')) abc from 'donor' a join 'acceptor' b on a.'city'=b.'city' group by a.'city')d
Here is my approach, it's telling me I have some manual error and I can't figure it out.