gpt4 book ai didi

php - mysqli案例问题从内部案例中选择

转载 作者:行者123 更新时间:2023-11-28 23:49:15 25 4
gpt4 key购买 nike

你好,这是我的代码,谁能告诉我哪里错了,因为我遇到了错误

select m.verify 
CASE eore WHEN '1' THEN c.mobile from epmem m, empl c
WHEN '2' THEN c.gender from epmem m, comp c
ELSE NULL END,
as 'expose' where (c.rid=m.mid) order by mid desc limit 50

错误是

 #1064 - Erreur de syntaxe près de 
'CASE eore WHEN '1' THEN c.mobile
from epmem m, empl c WHEN '2' THEN c.gender fro' Ã la ligne 1

这就是我想要达到的目标我想将一个表与另一个表连接起来,另一个表是动态的,将根据大小写值....

我想要的是在案例 1 中加入 empl 和 epmem,在案例 2 中加入 comp 和 epmem,并在代码中选择相关数据....

最佳答案

每个CASE语句都有END

SELECT m.verify,m.mid,
CASE eore
WHEN '1' THEN c.mobile
WHEN '2' THEN d.gender
ELSE NULL END AS 'expose'
FROM epmem m
INNER JOIN empl c ON c.rid = m.mid
INNER JOIN comp d ON d.rid = m.mid
ORDER BY m.mid DESC
LIMIT 50

编辑:

SELECT m.mid,m.email,m.eore,m.date,m.ipj,m.verify,
CASE eore WHEN '1' THEN d.mobile else c.gender END as expose1,
CASE eore WHEN '1' THEN d.profile else c.profile END as expose2,
CASE eore WHEN '1' THEN d.veri else c.mobile END as expose3
FROM epmem m
JOIN empl c ON c.rid = m.mid
JOIN comp d ON d.rid = m.mid
ORDER BY m.mid DESC
LIMIT 50

关于php - mysqli案例问题从内部案例中选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32904368/

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