mysql 交叉表 别名问题 使用的是dbutils

guotb007 2013-10-10 10:52:58
联系一段程序,发现个问题,解决了好久都没成功,请教达人!
一、我使用的是mysql数据库,其中dbutils已修正,可以识别 别名。
二、但使用交叉表将行转换成列以后,dbutils中返回的List里面的map就不能通过列名(例如以下sql中的 1、2、3等)获取数值了。即使换成英文字符也不可以。但没有交叉的列(例如:ryfl.row_id,ryfl.cmid等通过别名是可以取到的)。

不知各位有没有遇到过该问题,请达人帮分析一下!!谢谢!!!

select ryfl.row_id,ryfl.cmid,ryfl.flid,cmxx.cmxm,cmxx.cmsfzh,flxx.flmc,flxx.jedw,cmflffxx.nf,
if(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end))) as '1',
if(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end))) as '2',
if(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end))) as '3',
if(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end))) as '4',
if(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end))) as '5',
if(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end))) as '6',
if(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end))) as '7',
if(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end))) as '8',
if(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end))) as '9',
if(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end))) as '10',
if(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end))) as '11',
if(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end))) as '12'
from ryfl
left join (select cmflffxx.yf,cmflffxx.nf,cmflffxx.cmid,cmflffxx.flid,cmflffxx.ryflid from cmflffxx where cmflffxx.nf = '2013') cmflffxx
on ryfl.cmid = cmflffxx.cmid and ryfl.flid = cmflffxx.flid and ryfl.row_id = cmflffxx.ryflid
...全文
194 5 打赏 收藏 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
guotb007 2013-10-11
  • 打赏
  • 举报
回复
引用 4 楼 ssp2009 的回复:
虚拟表换个表名或者直接关联cmflffxx 表查询啊。
cmflffxx换个虚拟表也不行,效果是一样的。 另:无法直接关联cmflffxx,因为该表的查询是需要条件的。 谢谢你!
LongRui888 2013-10-11
  • 打赏
  • 举报
回复
这样行不,试试看:
select ryfl.row_id,ryfl.cmid,ryfl.flid,cmxx.cmxm,cmxx.cmsfzh,flxx.flmc,flxx.jedw,cmflffxx.nf,
if(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end))) as wc1,
if(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end))) as wc2,
if(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end))) as wc3,
if(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end))) as wc4,
if(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end))) as wc5,
if(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end))) as wc6,
if(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end))) as wc7,
if(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end))) as wc8,
if(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end))) as wc9,
if(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end))) as wc10,
if(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end))) as wc11,
if(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end))) as wc12
from ryfl 
left join  (select cmflffxx.yf,cmflffxx.nf,cmflffxx.cmid,cmflffxx.flid,cmflffxx.ryflid from cmflffxx where cmflffxx.nf = '2013') cmflffxx
on ryfl.cmid = cmflffxx.cmid and ryfl.flid = cmflffxx.flid and ryfl.row_id = cmflffxx.ryflid
快溜 2013-10-11
  • 打赏
  • 举报
回复
虚拟表换个表名或者直接关联cmflffxx 表查询啊。
guotb007 2013-10-11
  • 打赏
  • 举报
回复
引用 1 楼 yupeigu 的回复:
这样行不,试试看:
select ryfl.row_id,ryfl.cmid,ryfl.flid,cmxx.cmxm,cmxx.cmsfzh,flxx.flmc,flxx.jedw,cmflffxx.nf,
if(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end))) as wc1,
if(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end))) as wc2,
if(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end))) as wc3,
if(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end))) as wc4,
if(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end))) as wc5,
if(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end))) as wc6,
if(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end))) as wc7,
if(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end))) as wc8,
if(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end))) as wc9,
if(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end))) as wc10,
if(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end))) as wc11,
if(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end))) as wc12
from ryfl 
left join  (select cmflffxx.yf,cmflffxx.nf,cmflffxx.cmid,cmflffxx.flid,cmflffxx.ryflid from cmflffxx where cmflffxx.nf = '2013') cmflffxx
on ryfl.cmid = cmflffxx.cmid and ryfl.flid = cmflffxx.flid and ryfl.row_id = cmflffxx.ryflid
不可以,现在的原因应该是虚拟表和虚拟行的原因!只是我还没找到解决方法。
guotb007 2013-10-11
  • 打赏
  • 举报
回复
引用 楼主 guotb007 的回复:
联系一段程序,发现个问题,解决了好久都没成功,请教达人! 一、我使用的是mysql数据库,其中dbutils已修正,可以识别 别名。 二、但使用交叉表将行转换成列以后,dbutils中返回的List里面的map就不能通过列名(例如以下sql中的 1、2、3等)获取数值了。即使换成英文字符也不可以。但没有交叉的列(例如:ryfl.row_id,ryfl.cmid等通过别名是可以取到的)。 不知各位有没有遇到过该问题,请达人帮分析一下!!谢谢!!! select ryfl.row_id,ryfl.cmid,ryfl.flid,cmxx.cmxm,cmxx.cmsfzh,flxx.flmc,flxx.jedw,cmflffxx.nf, if(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end))) as '1', if(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end))) as '2', if(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end))) as '3', if(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end))) as '4', if(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end))) as '5', if(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end))) as '6', if(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end))) as '7', if(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end))) as '8', if(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end))) as '9', if(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end))) as '10', if(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end))) as '11', if(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end))) as '12' from ryfl left join (select cmflffxx.yf,cmflffxx.nf,cmflffxx.cmid,cmflffxx.flid,cmflffxx.ryflid from cmflffxx where cmflffxx.nf = '2013') cmflffxx on ryfl.cmid = cmflffxx.cmid and ryfl.flid = cmflffxx.flid and ryfl.row_id = cmflffxx.ryflid
不可以,现在的原因应该是虚拟表和虚拟行的原因!只是我还没找到解决方法。
内容概要:本文系统研究了基于雅可比伪逆迭代的双臂协同轨迹规划与跟踪误差收敛性问题,结合机械臂正向与逆向运动学建模、蒙特卡洛法分析工作空间、笛卡尔空间内的圆弧轨迹生成等关键技术,利用Matlab实现了双臂系统的协同控制与轨迹跟踪仿真。重点探讨了雅可比矩阵伪逆法在解决冗余自由度机械臂逆运动学问题中的应用,深入分析了轨迹跟踪过程中误差的收敛特性,并通过仿真实验验证了该方法在复杂任务场景下的有效性、稳定性与鲁棒性,为多臂机器人在工业自动化、精密操作等领域的协同作业提供了理论依据与技术支持。; 适合人群:具备机器人学、自动控制理论基础及Matlab编程能力的科研人员与工程技术人员,特别适合从事机械臂控制、轨迹规划、多机器人协同等方向的硕士、博士研究生及相关领域研究人员。; 使用场景及目标:①掌握基于雅可比伪逆法的机械臂逆运动学求解原理与实现方法;②理解双臂系统在笛卡尔空间中协同轨迹规划的机制;③分析并优化轨迹跟踪过程中的误差收敛性能;④为多机器人系统在复杂动态环境下的高精度协同控制提供算法设计与仿真验证支持。; 阅读建议:建议读者结合文中提供的Matlab代码进行实践操作,按照文档目录循序渐进地学习,重点关注算法实现细节、仿真参数设置与结果分析部分,同时可进一步探索将智能优化算法或深度学习方法引入轨迹规划与误差补偿的研究方向。

22,298

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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