我写了下面的查询得到上传结果。
set @v_stk_code = '50400'; -- 2753,8601
set @v_date = '0619';
set @sas = (Select Count(file_name) from ims_data.batchlog where file_name like concat('%',@v_stk_code ,'%',@v_date,'.txt','%') and file_name like 'SAS%' and upload_status = 'success');
set @product = (Select Count(file_name) from ims_data.batchlog where file_name like concat('%',@v_stk_code ,'%',@v_date,'.txt','%') and file_name like 'P%' and upload_status = 'success');
Select @v_stk_code,
case
when @sas=0 and @product=0 then 'SAS and Product not Uploaded'
when @sas>0 and @product>0 then 'SAS and Product is Uploaded'
when @sas>0 and @product=0 then 'SAS uploaded but Product File Missing'
when @sas=0 and @product>0 then 'Product uploaded but SAS File Missing'
end as `Status`;
我得到了一个最粗代码的结果,但我想得到多个最粗的结果,这将在参数中提供。