Where problem ? select work fine.. when check in where - give error Unknown column 'confirm' in 'where clause'
SELECT
users_id, MD5(CONCAT(users_pass, users_email)) AS confirm
FROM
(users_items)
WHERE users_active = 0
AND confirm = '39a5eccb97f63a2bb649ddd95c5a3ba7'
LIMIT 1
Run Code Online (Sandbox Code Playgroud)
因为确认是一个alias.
您不能在同一级别的查询中使用alias该where子句.
你必须做
where xxx
and MD5(CONCAT(users_pass, users_email)) = '39a5eccb97f63a2bb649ddd95c5a3ba7'
Run Code Online (Sandbox Code Playgroud)
或者,如Vatev所述,您可以在HAVING子句中使用别名.但是使用一个HAVING条款可能会对性能产生影响.
导致查询过滤器(例如,尝试使用索引)和HAVING子句过滤这些过滤数据的原因.
where xxx
HAVING confirm = '39a5eccb97f63a2bb649ddd95c5a3ba7'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7385 次 |
| 最近记录: |