SQL 子查询:select 所有值,但一种类型的值仅高于
SQL sub-query: select all values but for one type of values only higher than
是否可以获取所有货币的所有价值,但只获取一种特定货币高于 10000 美元的价值?
select case
when currency_id = '57' then 'EUR'
when currency_id = '26' then 'USD'
when currency_id = '51' then 'HKD' end as CCY,
amount, ECPNBR, value_date
from money_transfer
where (select amount from money_transfer where currency_id ='26')>10000 order by amount desc;
出现错误“子查询 returns 超过 1 个值...”
也许你的查询如下
select
case
when m.currency_id = '57' then 'EUR'
when m.currency_id = '26' then 'USD'
when m.currency_id = '51' then 'HKD'
else ''
end,
m.amount, m.ECPNBR, m.value_date
from money_transfer where ( m.currency_id='26' and m.amount>10000) OR (m.currency_id<>'26')
order by m.amount desc;
是否可以获取所有货币的所有价值,但只获取一种特定货币高于 10000 美元的价值?
select case
when currency_id = '57' then 'EUR'
when currency_id = '26' then 'USD'
when currency_id = '51' then 'HKD' end as CCY,
amount, ECPNBR, value_date
from money_transfer
where (select amount from money_transfer where currency_id ='26')>10000 order by amount desc;
出现错误“子查询 returns 超过 1 个值...”
也许你的查询如下
select
case
when m.currency_id = '57' then 'EUR'
when m.currency_id = '26' then 'USD'
when m.currency_id = '51' then 'HKD'
else ''
end,
m.amount, m.ECPNBR, m.value_date
from money_transfer where ( m.currency_id='26' and m.amount>10000) OR (m.currency_id<>'26')
order by m.amount desc;