oracle - wrong query output when using where and having in the same SQL statement -
select currency.currencyname, currency.currencysymbol, countryname.currencycode, currency.exchangerate currency,countryname currency.currencycode=countryname.currencycode having currency.exchangerate >= max(currency.exchangerate) group currency.currencyname, currency.currencysymbol, countryname.currencycode, currency.exchangerate;
this output getting , know wrong because trying display maximum exchange rate . resolve query appreciate. oracle sql developer
currencyname currencysymbol currencycode exchangerate -------------------- -------------------- ------------ ------------ british pound £ gbp 1, dollar $ usd 1.9626 , danish krone kr dkk 9.9918 , malaysian ringgit rm myr 6.35392 , euro € eur 1.34076 , indian rupee rs inr 77.3265 , japanese yen ¥ jpy 209.881,
try following
select currency.currencyname, currency.currencysymbol, countryname.currencycode, max(currency.exchangerate) exchangerate currency inner join countryname on countryname.currencycode = currency.currencycode group currency.currencyname, currency.currencysymbol, countryname.currencycode;
Comments
Post a Comment