JSP+MSSQL多表查询

selecttuoyun.tiji,yingshou.shoukuanjine,yingfu.fukuanjinefromtuoyun,yingshou,yingfuwh... select tuoyun.tiji,yingshou.shoukuanjine,yingfu.fukuanjine from tuoyun,yingshou,yingfu where tuoyun.yewubaogaodanhao = yingshou.baogaodanhao and yingshou.baogaodanhao = yingfu.baogaodanhao
这个在查询分析器里面可以运行,但怎么改到页面里面去呢?
stringSql = "select tuoyun.yewubaogaodanhao,tiji yingshou.baogaodanhao,shoukuanjine"
+ " from tuoyun,yingshou where " + " tuoyun.yewubaogaodanhao like'%"+danhao+"%' = yingshou.baogaodanhao like'%"+danhao+"%' " ;
错在那里帮忙改下谢谢!
不行啊 报错
展开
 我来答
zhubo1205
2009-07-29
知道答主
回答量:5
采纳率:0%
帮助的人:0
展开全部
"select sum(a.jianshu)as jshj,round(sum(a.maozhong),2)as mzhj,round(sum(a.tiji),2)as tjhj,"
+ " round(sum(b.shoukuanjine),2)as shxj,round(sum(c.fukuanjine),2)as fkxj,"
+ " round((sum(b.shoukuanjine)-sum(c.fukuanjine)),2)as mlhj "
+ " from tuoyun a,"
+ "(select tidanhao,round(sum(shoukuanjine*huilv),2) shoukuanjine "
+ "from yingshou group by tidanhao ) b ,"
+ "(select tidanhao,round(sum(fukuanjine*huilv),2) fukuanjine "
+ "from yingfu group by tidanhao ) c "
+ " where a.tidanhao = b.tidanhao and b.tidanhao = c.tidanhao";
tingfeng85
2009-07-15 · TA获得超过627个赞
知道小有建树答主
回答量:1146
采纳率:0%
帮助的人:955万
展开全部
stringSql = "select tuoyun.yewubaogaodanhao,tuoyun.tiji,"
+" yingshou.baogaodanhao,shoukuanjine "
+" from tuoyun,yingshou ,yingfu "
+" where tuoyun.yewubaogaodanhao = yingshou.baogaodanhao "
+" and yingshou.baogaodanhao = yingfu.baogaodanhao "
+" and tuoyun.yewubaogaodanhao like '%"+danhao+"%' "
+" and yingshou.baogaodanhao like '%"+danhao+"%'";
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
hemu780924
2009-07-15 · TA获得超过662个赞
知道小有建树答主
回答量:495
采纳率:0%
帮助的人:522万
展开全部
stringSql = "select tuoyun.yewubaogaodanhao,tiji yingshou.baogaodanhao,shoukuanjine from tuoyun,yingshou ,yingfu where tuoyun.yewubaogaodanhao = yingshou.baogaodanhao and yingshou.baogaodanhao = yingfu.baogaodanhao
and tuoyun.yewubaogaodanhao like'%"+danhao+"%' = yingshou.baogaodanhao like'%"+danhao+"%' " ;
应该是你要的。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式