我该怎么办布尔逻辑上的MySQL中两列? [英] How can I do boolean logic on two columns in MySQL?

查看:169
本文介绍了我该怎么办布尔逻辑上的MySQL中两列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做一个选择在MySQL,结合几列......像这样的伪code:

I want to do a select in MySql that combines several columns... something like this pseudocode:

select payment1_paid and payment2_paid as paid_in_full from denormalized_payments where payment1_type = 'check';

修改:payment1_paid和paym​​ent2_paid是布尔值

Edit: payment1_paid and payment2_paid are booleans.

我无法用任何其他语言比MySQL这个特殊的问题。

I can't use any other language for this particular problem than MySql.

感谢您的帮助!

修改:对不起大家谁给我开了总结和连接的建议,但我投那些早期的答案,因为他们是有用的反正。和感谢以大家对你的令人难以置信的快速解答!

Edit: Sorry to everybody who gave me suggestions for summing and concatenating, but I've voted those early answers up because they're useful anyway. And thanks to everybody for your incredibly quick answers!

推荐答案

好吧,逻辑,你可以做

Select (payment1_paid && payment2_paid) as paid_in_full 
from denormalized_payments 
where payment1_type = 'check';

正如所看到的这里

这篇关于我该怎么办布尔逻辑上的MySQL中两列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆