从odk_prod._refinance_tags中选择*,其中(end_date如'%2017-06%'或end_date ='0000-00-00'),而app_no在('APP-000-095','APP-000-115')中

时间:2019-04-12 06:04:30

标签: sql

Select * from 
odk_prod._refinance_tags 
where (end_date like '%2017-06%' or end_date='0000-00-00') 
and app_no in ('APP-000-095','APP-000-115')

2 个答案:

答案 0 :(得分:0)

您错过了单引号

Select a.* from 
odk_prod._refinance_tags a
where (end_date like '%2017-06%' 
       or end_date='0000-00-00'
      ) 
      and app_no in ('APP-000-095','APP-000-115')

答案 1 :(得分:0)

我不知道您的问题是什么,但是您可以改善查询条件。

请勿使用like作为日期!而是使用日期函数和日期比较:

Select rt.*
from odk_prod._refinance_tags rt
where ( (rt.end_date >= '2017-06-01' AND
         rt.end_date < '2017-07-01'
        ) or
        rt.end_date = '0000-00-00'
      ) and
      rt.app_no in ('APP-000-095', 'APP-000-115');