参考:https://bbs.csdn.net/topics/330032307
数据库里面有一个字典表,这张表里面有id段和对应的名字字段。
在另外一个记录的表里面有对应的上述字典表的id,而且有多个字段都含有该id字段。需要将其查出来,并且用名字。
SELECT a.id AS ‘编号‘, ‘STORY‘ AS ‘类型‘ , a.title AS ‘标题‘,b.name AS ‘所属项目‘ ,a.project AS ‘所属项目‘ , c.realname AS ‘创建者‘, a.estimate AS ‘计划时间‘, d.realname AS ‘责任研发‘, a.resolvedDate AS ‘实际解决时间‘,a.closedDate AS ‘实际关闭时间‘,a.STATUS FROM zt_story a , zt_project b, zt_user c, zt_user d WHERE a.project=b.id AND a.openedby=c.account AND a.assignedTo=d.account AND a.id>=8650 AND a.id<= 8692 ORDER BY a.id SELECT a.id AS ‘编号‘, ‘BUG‘ AS ‘类型‘ , a.title AS ‘标题‘,b.name AS ‘所属项目‘ , c.realname AS ‘创建者‘, a.estimateDoneDate AS ‘计划时间‘, d.realname AS ‘责任研发‘, a.resolvedDate AS ‘实际解决时间‘,a.closedDate AS ‘实际关闭时间‘,a.STATUS FROM zt_bug a , zt_project b, zt_user c, zt_user d WHERE a.project=b.id AND a.openedby=c.account AND a.assignedTo=d.account AND a.id>=28095 ORDER BY a.id
原文地址:https://www.cnblogs.com/mobilecard/p/9195890.html
时间: 2024-11-05 18:29:42