关于将一条SQL语句查出的记录数作为where的查询条件stri
2010-10-17 09:11:22r***
string sql = String.Format("select distinct A.线路 from" +
" (select 线路,站点所属 from LineSite where 站点名称 = '{0}') A," +
" (select 线路,站点所属 from LineSite where 站点名称 = '{1}') B " +
" where A.线路 = B.线路 and A.站点所属 = B.站点所属 and "+
" ("
+" select Count(*) as stationCount "
+ " from lineSite, "
+ " (select siteID from lineSite where 线路='A.线路' and 站点名称='{0}' and 站点所属='上行线') A, "
+ " (select siteID from lineSite where 线路='A.线路' and 站点名称='{1}' and 站点所属='上行线')B, "
+ " (select siteID from lineSite where 线路='A.线路' and 站点名称='{0}' and 站点所属='下行线') C, "
+ " (select siteID from lineSite where 线路='A.线路' and 站点名称='{1}' and 站点所属='下行线')D "
+ " where lineSite.线路='A.线路' "
+ " and "
+ " ("
+ " ( A.siteId < B.SiteID "
+ " AND linesite.siteID between A.siteId and B.SiteID"
+ " )"
+ " OR"
+ " ( A.siteId >= B.SiteID "
+ " AND "
+ " linesite.siteID between c.siteId and d.SiteID "
+ " )"
+ " )"
+ ") > 0 ",
"师大", "北国商城");
Access数据库 SQL语句如上所示,这样写有问题啊,求高人~
问题补充:
在Access里不知道为什么执行起来特别慢
所以就在程序里运行了
下面这句话后面的子句有问题,上面的我已经测试过了,没问题。
" where A.线路 = B.线路 and A.站点所属 = B.站点所属 and "+关于将一条SQL语句查出的记录数作为where的查询条件stringsql=String.Format("selectdistinctA.线路from"+"(s?
最佳回答
2010-10-18 20:50:26
很赞哦! (99)
相关文章
- 上行宽带大于下行宽带表示什么意思??
- ADSL的上行/下行速率问题
- 上行和下行量的单位是什么?
- 宽带问题咨询
- 火车的上行和下行是如何分的,怎么才能确定上行和下行
- 手机频率的上行和下行
- 关于将一条SQL语句查出的记录数作为where的查询条件
- 100M光纤上下行
- 火车的上行和下行是如何分的,怎么才能确定上行和下行
- 公交的上行和下行是什么意思?
- 网速的上行和下行是什么意思?线路衰减值上行42KB正常吗?
- 关于三清山,索道上行下行问?
- 如何区分铁路上行线、下行线?
- ADSL线路上行512Kbps下行2Mbps
- 走下行还是上行线路?
- 公交车路线的问题
- 走下行还是上行线路?
- 求sql语句,用子句还?
- 走下行还是上行线路?
- 什么是下行和上行呢?
- 速率 下行 2.8Mbps 上行384kbps 下行14.4Mbps 上行5.76Mbps 下行3.1Mbps上行1.8Mbps
- 什么是下行和上行呢?
- 电梯只能上行不能下行是甚么问题
- ADSL的上行/下行速率问题
- 宽带问题咨询
- 如何区分铁路上行线、下行线?
- 请问这个ADSL噪声裕量和线路衰减正常吗?
- ADSL线路上行512Kbps下行2Mbps
- 下行流量是什么啊?
- 关于三清山,索道上行下行问?