boy0704 发表于 2007-4-25 16:25:26

看看这个语句错哪了?(急)

<p>&nbsp;strSql = "select * from (" +strSql+ ") as A where A.FSSJ &gt;= '"+strfssjQ+"'";</p><p>运行后出现debug Database:</p><p>select * from (select S.FSSJ,S.YWDM,S.CONTENT,F.CLBZ,F.WGFSSJ,S.ID,F.MSJH,D.NSRSBH,Q.MC,S.CZYBM from WG_PLFSSJTEMP_CLONE S,WG_PLFSSJFJTEMP_CLONE F,XT_SJQYDY D,YW_QYXX Q where S.ID = F.SJ_ID and F.MSJH = D.SJH and D.NSRSBH=Q.NSRSBH&nbsp; and (S.CZYBM in (select CZYDM from YW_CZYXX where&nbsp; SWJGDM = '') or S.CZYBM like '%自动发送程序%')) as A where A.FSSJ &gt;= '2005-04-24 13:31:15' and A.FSSJ &lt;= '2007-04-25 13:31:15' order by A.ID</p><p>运行不过去~~错误:as附近有错。</p><p>哪个高手给看看哈~~</p><p></p>

alan77 发表于 2007-4-27 06:31:33

<p>strSql = "select * from (" +strSql+ ") as A where A.FSSJ &gt;= '"+strfssjQ+"'";</p><p></p><p>&nbsp;table_name can not use&nbsp;&nbsp;(" +strSql+ ") </p><p></p>
[此贴子已经被作者于2007-4-27 6:43:10编辑过]

boy0704 发表于 2007-4-27 09:27:41

虚拟表

<p>&nbsp;strSql = "select * from (" +strSql+ ") as A where A.FSSJ &gt;= '"+strfssjQ+"'";</p><p>我的意思是做一个嵌套,(" +strSql+ ") 是构成一个虚拟表。由于业务需要,所以只能采用这样的方法。</p>

alan77 发表于 2007-4-27 13:32:06

<p></p><span lang="ZH-CN" style="FONT-SIZE: 10pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: 新細明體; mso-hansi-font-family: 新細明體;"><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><font size="3"><span lang="EN-US" style="mso-bidi-font-size: 12.0pt;"><font face="Calibri"><p></p></font></span></font></p><p></p><p></p><p></p><p></p><p></p><p></p><span lang="EN-US" style="mso-bidi-font-size: 12.0pt;"><p></p></span><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">table_name can not use<span style="mso-spacerun: yes;">&nbsp; </span>(" +strSql+ ") --&gt; strSql </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">不能是</span><font face="Calibri"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"> column data</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<p></p></span></font></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><font face="Calibri"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;">strSql = "select * from (" +strSql+ ") as A where A.FSSJ &gt;= '"+strfssjQ+"'";</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<p></p></span></font></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">我会写成</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><font face="Calibri"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<p></p></font></span></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><font face="Calibri"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;">strSql = 'select * from '+"'"+strSql+"'"+' as A where A.FSSJ &gt;= '+"'"+strfssjQ+"'";</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><br/><p></p></span></font></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">strSql </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">当然就是</span><font face="Calibri"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"> table_name</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><p></p></span></font></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">不可以是</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><font face="Calibri"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">(select S.FSSJ,S.YWDM,S.CONTENT,F.CLBZ,F.WGFSSJ,S.ID,F.MSJH,D.NSRSBH,Q.MC,S.CZYBM from WG_PLFSSJTEMP_CLONE S,WG_PLFSSJFJTEMP_CLONE F,XT_SJQYDY D,YW_QYXX Q where S.ID = F.SJ_ID and F.MSJH = D.SJH and D.NSRSBH=Q.NSRSBH<span style="mso-spacerun: yes;">&nbsp; </span>and (S.CZYBM in (select CZYDM from YW_CZYXX where<span style="mso-spacerun: yes;">&nbsp; </span>SWJGDM = '') or S.CZYBM like '%</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">自动发送程序</span><font face="Calibri"><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;">%'))</span><span lang="EN-US" style="FONT-SIZE: 11pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<p></p></span></font></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US" style="FONT-SIZE: 11pt;"><p><font face="Calibri"></font></p></span></p><p><font face="Calibri"></font></p><p></p><p><font face="Calibri"></font></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">或许你可以在数据库内建立一个</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">temporary table,</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">再将上方</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">sql </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">值</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri"> insert </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">进去在用</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri"> temporary table </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">前记得</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri"> commit; </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">将里面值清空</span><span lang="EN-US" style="FONT-SIZE: 11pt;"><p></p></span></p><p></p><p></p><p></p><p></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">此种</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">table</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">多数用于处理数据统计</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">,,</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">每个</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">client </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">端可以将要统计数据丢内此</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">table</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">内做暂时计算</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">(</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">很多报表会用到</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">),</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">它也像是虚拟</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">table,</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">特别是每个</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">client</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">端都只会看到自己的</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">,</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">不会有别人的数据</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">,</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">也就是每个</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri"> client </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">端这个</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">table </font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">值都是不一样的</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">,</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">许多其他中大型数据库也是这几年才有这种</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">table</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">但</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;"><font face="Calibri">sybase</font></span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">很早前就有</span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"></span><span lang="EN-US" style="FONT-SIZE: 11pt;"><font face="Calibri"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"></span></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US" style="FONT-SIZE: 11pt;"><font face="Calibri"><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">或者可以</span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">试做个</span><span lang="EN-US" style="FONT-SIZE: 11pt; mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun;">view, </span><span lang="ZH-CN" style="FONT-SIZE: 11pt; FONT-FAMILY: SimSun; mso-fareast-language: ZH-CN; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">我相信不难做到</span></font></span></p></span>
[此贴子已经被作者于2007-4-28 11:14:46编辑过]
页: [1]
查看完整版本: 看看这个语句错哪了?(急)

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com