简体   繁体   English

选择两列不能同时为0的行

[英]Select rows where two columns cannot be 0 at same time

I have mysql table full of songs. 我有充满歌曲的mysql表。 Every row has column minutes and column seconds. 每行都有列分钟和列秒。 What I want to do is create query for selecting all songs that don't have both columns set to zero(minutes = 0 && seconds = 0). 我想做的是创建查询,以选择没有两列都设置为零(分钟= 0 &&秒= 0)的所有歌曲。 But at the same time I want to collect all songs that have 0 minutes and x seconds || 但是同时我想收集所有具有0分零秒||秒的歌曲。 x minutes and 0 seconds. x分钟0秒。

Pretty straightforward 非常简单

SELECT * FROM Songs WHERE NOT(minutes = 0 AND seconds = 0)

There are couple more solutions @GordonLinoff suggested one also: @GordonLinoff还提供了其他几种解决方案:

SELECT * FROM Songs WHERE minutes <> 0 OR seconds = 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM