select *,--再加一个标识字段就好了case when flag>10 then ‘y’else 'n' end as flag from (select day(下单日期) -day( 登记日期) as flag ,* from table_name)