double * cast = (double*)cx;
嗨,我正在尝试在select for email列上应用规则。有时登录ID将是用户的电子邮件地址,如何应用规则,如果电子邮件出现在登录ID中,则不返回电子邮件列的任何内容?任何帮助将不胜感激,谢谢。
答案 0 :(得分:2)
CASE...WHEN
应该这样做。基本上,你明确地处理这两种情况。
SELECT LTRIM(RTRIM(HOST0149.LOGINID)) AS LOGINID,
CASE WHEN LTRIM(RTRIM(HOST0140.EMAIL)) = LTRIM(RTRIM(HOST0149.LOGINID)) THEN NULL ELSE LTRIM(RTRIM(HOST0140.EMAIL)) END AS EMAIL,
LTRIM(RTRIM(HOST0149.USERKEY)) AS ROLE
FROM HOST0149 LEFT JOIN
HOST0140 ON HOST0149.PERSONKEY = HOST0140.PERSONKEY
答案 1 :(得分:1)
我认为case
表达式符合您的要求:
SELECT LOGINID,
(CASE WHEN LOGINID <> EMAIL THEN EMAIL END) as EMAIL,
ROLE
FROM (SELECT LTRIM(RTRIM(HOST0149.LOGINID)) AS LOGINID,
LTRIM(RTRIM(HOST0140.EMAIL)) AS EMAIL,
LTRIM(RTRIM(HOST0149.USERKEY)) AS ROLE
FROM HOST0149 LEFT JOIN
HOST0140
ON HOST0149.PERSONKEY = HOST0140.PERSONKEY
) hh
答案 2 :(得分:1)
这将得到结果:
echo '<span style="color:#E02F2F;text-align:center;font-size:25px;padding-left:38%;">Username or Password is valid</span>';
header('Location:http://example.com/templates/georamble/index.php'); // Redirecting To Other Page