What is wrong with this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is wrong with this code?

WITH processed_users AS (  SELECT left(u.phone_country, 2) AS short_phone_country, u.id FROM users u ) SELECT t.user_id, t.merchant_country, sum(t.amount / fx.rate / power(10, cd.exponent)) AS amount FROM transactions t JOIN fx_rates fx ON (fx.ccy = t.currency AND fx.base_ccy = 'EUR') JOIN currency_details cd ON cd.currency = t.currency JOIN processed_users pu ON pu.id = t.user_id WHERE t.source = 'GAIA' AND pu.short_phone_country = t.merchant_country GROUP BY t.user_id, t.merchant_country ORDER BY amount DESC;

22nd Feb 2020, 8:59 PM
Fabiano Santos
2 Answers
0
Fabiano Anna , what is expected and what is happening?
23rd Feb 2020, 8:54 AM
phil
0
We got this home work, the only question phil is. Will it work or not, and why. Now, would the *left* condition work in this?
23rd Feb 2020, 9:20 AM
Fabiano Santos