gpt4 book ai didi

mysql - 拉入另一列进行查询

转载 作者:行者123 更新时间:2023-11-30 01:17:22 25 4
gpt4 key购买 nike

我有一个查询,需要在其中添加一个附加列。我的灰质暂时死亡,需要帮助。

按原样查询

SELECT g.groupId,g.name AS groupName,l.logId,l.name AS logName, i.itemID,
i.name AS itemName, le.userName,completed, i.optimalMin,i.optimalMax ,le.value,
u.name AS unitDescription,g.parentId
FROM logExceptions le
INNER JOIN logs l ON l.logID = le.logID
INNER JOIN groups g ON g.groupId = l.groupId
INNER JOIN items i ON le.itemId = i.itemId
INNER JOIN units u ON i.unitId = u.unitId

列名实际上是 l.name,但针对的是parentId。所附图片将显示我的意思。

最佳答案

解决方案 选择 g.groupId,g.name AS groupName,l.logId,l.name AS logName, i.itemID, i.name AS itemName, le.userName,completed, i. optimalMin,i.optimalMax,le.value, u.name AS unitDescription,g.parentId,g1.name AS ParentName FROM logExceptions le INNER JOIN 日志 l ON l.logID = le.logID INNER JOIN 组 g ON g.groupId = l .groupId INNER JOIN 项目 i ON le.itemId = i.itemId left JOIN groups g1 ON g.parentId = g1.groupId INNER JOIN 单位 u ON i.unitId = u.unitId

关于mysql - 拉入另一列进行查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18928188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com