0

我正在实现一个系统登录,在数据库中我有这个表:

cat_clients

Id    Name    Rfc        Email            P_Name          P_Email          S_Name          S_Email          T_Name          T_Email
_______________________________________________________________________________________________________________________________________
1     Rick    RFC2345    rick@email.com    George      george@email.com    Daniel     daniel@email.com      Fred        fre@email.com
2     Mary    RFC2212    mary@email.com    Brad        brad@email.com      Allan      allan@email.com       Edward      edward@email.com
......
.....
.... more

因此,要成功登录,用户必须输入“Rfc”和任何电子邮件(Email、P_Email、S_Email 和 T_Email)。用户拥有这些电子邮件是因为它们是替代联系人。

询问

SELECT * 
FROM cat_clients
WHERE (Email = 'george@email.com' OR P_Email = 'george@email.com' OR S_Email = 'george@email.net' OR T_Email = 'george@email.com') AND Rfc = 'RFC2345';

但我的查询不起作用。我希望我解释了。

提前致谢

4

1 回答 1

0

尝试

SELECT * 
FROM cat_clients
WHERE 'george@email.com' IN (Email, P_Email, S_Email, T_Email) AND
      Rfc = 'RFC2345';
于 2012-11-26T15:17:38.450 回答