看看这个语句错哪了?(急)
<p> strSql = "select * from (" +strSql+ ") as A where A.FSSJ >= '"+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 and (S.CZYBM in (select CZYDM from YW_CZYXX where SWJGDM = '') or S.CZYBM like '%自动发送程序%')) as A where A.FSSJ >= '2005-04-24 13:31:15' and A.FSSJ <= '2007-04-25 13:31:15' order by A.ID</p><p>运行不过去~~错误:as附近有错。</p><p>哪个高手给看看哈~~</p><p></p> <p>strSql = "select * from (" +strSql+ ") as A where A.FSSJ >= '"+strfssjQ+"'";</p><p></p><p> table_name can not use (" +strSql+ ") </p><p></p>[此贴子已经被作者于2007-4-27 6:43:10编辑过]
虚拟表
<p> strSql = "select * from (" +strSql+ ") as A where A.FSSJ >= '"+strfssjQ+"'";</p><p>我的意思是做一个嵌套,(" +strSql+ ") 是构成一个虚拟表。由于业务需要,所以只能采用这样的方法。</p> <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;"> </span>(" +strSql+ ") --> 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/> <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 >= '"+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="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/> <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 >= '+"'"+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/> </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;"> </span>and (S.CZYBM in (select CZYDM from YW_CZYXX where<span style="mso-spacerun: yes;"> </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;"> <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]