本文介绍了简单如果在SQL中的Else语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从只有更多货币的表格中获取美元和欧元的行。
I'm trying to get only the rows that are in USD and EUR from a table with more currencies.
我认为代码应该是这样的:
I thought the code should be something like:
SELECT IF(CONTRACTS_IN_DIFFERENT_CURRENCIES.CURRENCY='USD',1,0) OR IF(CONTRACTS_IN_DIFFERENT_CURRENCIES.CURRENCY='EUR',1,0
FROM CONTRACTS_IN_DIFFERENT_CURRENCIES
但我知道这不是应该的样子。我会比如表格就像一列美元和欧元
But I know this is not how it should be. I would like the table to be something like a column of USD and EUR
推荐答案
前面的答案在我看来很好,但是让我们说你会有很多货币,你可以做到
The preceding answers are good in my opinion, but let's say you would have alot of currencies, you could do
SELECT * FROM CONTRACTS_IN_DIFFERENT_CURRENCIES WHERE CURRENCY IN ("USD","EUR")
这篇关于简单如果在SQL中的Else语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!