我在rails中使用这个查询
这里: @album_ids
,@country_ids
是数组
@audios= Audio.where({:album_id => @album_ids, :country_id => @country_ids})
It produces following SQL:
Audio Load (0.3ms) SELECT `audios`.* FROM `audios` WHERE `audios`.`album_id` IN (1, 2) AND `audios`.`country_id` IN (1, 2)
但我希望查询生成为:
Audio Load (0.3ms) SELECT `audios`.* FROM `audios` WHERE `audios`.`album_id` IN (1, 2) OR `audios`.`country_id` IN (1, 2)
OR
而不是AND
提前致谢