临时记录
select distinct /** case when REPLACE(substring(b.register_no,0,2),'f','F')='F' then b.f_name else a.h_master end as hMaster, **/
a.h_master,
b.print_no,b.doc_no,case when ltrim(rtrim(isnull(b.f_name,''))) =''
then a.id_no else isnull(b.cartno,'') end as certificateno,isnull(a.telephone,'') as telephone,
b.f_name
from fcmess a inner join roomstate b on a.register_no = b.register_no
and ((ltrim(rtrim(b.print_no)) = ?
and ltrim(rtrim(isnull(b.doc_no,''))) = ?)
or (ltrim(rtrim(b.print_no)) = ?
and ltrim(rtrim(isnull(b.doc_no,''))) = ''))
and b.register_no = ?
试下这条sql捏
同样是问号改成doc_no和print_no
不过多了个register_no
a.h_master,
b.print_no,b.doc_no,case when ltrim(rtrim(isnull(b.f_name,''))) =''
then a.id_no else isnull(b.cartno,'') end as certificateno,isnull(a.telephone,'') as telephone,
b.f_name
from fcmess a inner join roomstate b on a.register_no = b.register_no
and ((ltrim(rtrim(b.print_no)) = ?
and ltrim(rtrim(isnull(b.doc_no,''))) = ?)
or (ltrim(rtrim(b.print_no)) = ?
and ltrim(rtrim(isnull(b.doc_no,''))) = ''))
and b.register_no = ?
试下这条sql捏
同样是问号改成doc_no和print_no
不过多了个register_no