朋友进来(找一个朋友)

kangqing 2003-10-15 05:26:14
sql="select company.*,ordgood.* from company,ordgood where (select ord.* company.* from ord,company where ord.ord_company=company.company_id) and (select ord.*,ordgood.* from ord,ordgood where ord.ord_on=ordgood.ordgood_ord_on) and isnull(company.company_name '') like '%" + company_name + "%' and (isnull(company.company_man1 '') like '%" + company_man + "%' or isnull(company.company_man2 '') like '%" + company_man + "%' or isnull(company.company_owner '') like '%" + company_man + "%') and (isnull(company.company_tel1 '') like '%" + company_tel + "%' or isnull(company.company_mobile1 '') like '%" + company_tel + "%' or isnull(company.company_tel2 '') like '%" + company_tel + "%' or isnull(company.company_mobile2 '') like '%" + company_tel + "%') and isnull(good.good_code like '') '%" + good_code + "%' and isnull(good.good_name '') like '%" + good_name + "%')"
...全文
107 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjcxc 元老 2003-10-15
  • 打赏
  • 举报
回复
既然已经解决,就将解决的贴出来吧.
yujohny 2003-10-15
  • 打赏
  • 举报
回复
sql='select company.*,ordgood.* from company,ordgood
where (select ord.* company.* from ord,company
where ord.ord_company=company.company_id) and
(select ord.*,ordgood.* from ord,ordgood
where ord.ord_on=ordgood.ordgood_ord_on) and
isnull(company.company_name, '''') like ''%'' + company_name + ''%''
and (isnull(company.company_man1, '''') like ''%''
+ company_man +''%'' or isnull(company.company_man2, '''') like ''%''
+ company_man + ''%'' or isnull(company.company_owner,'''') like ''%''
+ company_man + ''%'') and (isnull(company.company_tel1, '''')
like ''%'' + company_tel + ''%'' or isnull(company.company_mobile1, '''')
like ''%'' + company_tel + ''%'' or isnull(company.company_tel2, '''') like ''%'' + company_tel + ''%'' or isnull(company.company_mobile2, '') like ''%'' + company_tel + ''%'') and isnull(good.good_code,'') ''%'' + good_code + ''%'' and isnull(good.good_name '''') like ''%''+ good_name + ''%'')'


txlicenhe 2003-10-15
  • 打赏
  • 举报
回复
建议and ,or 太多时加一些括号。
sql=
"select company.*,ordgood.* from company,ordgood where
(select ord.* company.* from ord,company where ord.ord_company=company.company_id)
and (select ord.*,ordgood.* from ord,ordgood where ord.ord_on=ordgood.ordgood_ord_on)
and isnull(company.company_name '') like '%" + company_name + "%'
and ( (isnull(company.company_man1 '') like '%" + company_man + "%'
or isnull(company.company_man2 '') like '%" + company_man + "%'
or isnull(company.company_owner '') like '%" + company_man + "%') )
and ( (isnull(company.company_tel1 '') like '%" + company_tel + "%'
or isnull(company.company_mobile1 '') like '%" + company_tel + "%'
or isnull(company.company_tel2 '') like '%" + company_tel + "%'
or isnull(company.company_mobile2 '') like '%" + company_tel + "%') )
and isnull(good.good_code like '') '%" + good_code + "%'
and isnull(good.good_name '') like '%" + good_name + "%')"
weichenggao 2003-10-15
  • 打赏
  • 举报
回复
关于楼主的问题我已私下和楼主联系,并得到解决,谢谢!
weichenggao 2003-10-15
  • 打赏
  • 举报
回复
是我,帮你定!
txlicenhe 2003-10-15
  • 打赏
  • 举报
回复
1:怎么了?好象没问题啊。
2:你找哪位,我帮你叫他。

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧