SELECT
book.NAME,
SUM(IF(store.CITY = 'Moscow', QUANTITY, 0)) AS CITY1_QUANTITY,
SUM(IF(store.CITY = 'London', QUANTITY, 0)) AS CITY2_QUANTITY,
SUM(IF(store.CITY = 'Moscow', QUANTITY, 0)- IF(store.CITY = 'London', QUANTITY, 0)) AS DIFF_QUANTITY
FROM book
LEFT JOIN book_store ON book_store.BOOK_ID = book.ID
JOIN store ON store.ID = book_store.STORE_ID
WHERE store.CITY IN ('Moscow', 'London')
GROUP BY book.NAME;
не могу найти ошибку
int y = n/2;
...
&& (y > (n-1))
всегда false.Программа в каждом случае выдаёт 0.
int deadEnds = 0;
...
100*deadEnds/trials == 0
0/n = 0