我想构造这样的sql条件。我有一辆桌子车,它有这样的字段id_status,id_category和storage_address。我需要选择id_status(2,4) 中的汽车,如果id_category = 4我需要检查字段storage_address是否为空或为空。我怎么能做到?我应该使用sqlif语句吗?我需要类似的东西:
select * from car where id_status in (2,4) and if(id_category =
4,storage_address is NOT NULL,'1=1')