-1

嗨,我有下表

feeder_bouts2

id|feeder|rfid |bout_time |success|
1 | 2 | 123456789 |2013-01-07 80:00:00 | 1 |

我正在运行以下查询

select count(*), feeder 
from feeder_bouts2 
where bout_time >='2013-01-01 8:00:00'
    and rfid !='123456789' and success ='1'
group by feeder;

这非常有效,但是我想选择相同的输出,但只选择多个特定馈线的输出,例如馈线 1、2、3、4、6、7、8 之类的

select count(*), feeder 
from feeder_bouts2 
where bout_time >='2013-01-01 8:00:00' 
    and rfid !='123456789' and success ='1' 
    and feeder = '1,2,3,4,8,9,10' 
group by feeder;

提前感谢大家

4

1 回答 1

1

利用IN

select count(*), feeder 
from feeder_bouts2 
where bout_time >='2013-01-01 8:00:00' 
and rfid !='123456789' 
and success ='1' 
and feeder in (1,2,3,4,8,9,10)
group by feeder;
于 2013-01-07T16:47:15.520 回答