gpt4 book ai didi

mysql - 使用 case 函数合并 2 个 SELECT 查询

转载 作者:行者123 更新时间:2023-11-29 15:36:20 26 4
gpt4 key购买 nike

我的第一个查询是:

SELECT c.icareno, c.operation_date, p.prod_cat_name, prod.product_name, c.nename,
c.operation_desc, u.uname, c.oper_severity, c.rfc_status
FROM ccb c, product_cat p, userlogininfo u, productname prod
WHERE c.prod_cat = p.prod_cat_id
AND c.prod_id = prod.prod_id
AND c.oper_leader = u.userid
AND c.ccb_id <= 279
ORDER BY c.operation_date;

第二个查询是

SELECT c.icareno, c.operation_date, p.prod_cat_name, prod.product_name, node.node_name, 
c.operation_desc, u.uname, c.oper_severity, c.rfc_status
FROM ccb c, product_cat p, userlogininfo u, productname prod, node_list node
WHERE c.prod_cat = p.prod_cat_id
AND c.prod_id = prod.prod_id
AND c.oper_leader = u.userid
AND c.ccb_id > 279
AND c.nename = node.node_id
ORDER BY c.operation_date;

我想使用 CASE 函数合并这两个查询?谁能帮助我如何合并它?

示例数据:

enter image description here

最佳答案

and ((c.ccb_id > 279 AND c.nename =    node.node_id) or c.ccb_id <= 279)

关于mysql - 使用 case 函数合并 2 个 SELECT 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58212087/

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