我有以下查询:

SELECT concat(first_name, ' ', last_name) as full_name FROM auth_user


我将如何做:

SELECT concat(first_name, ' ', last_name) as full_name FROM auth_user
    **WHERE full_name IS NOT NULL**


(产生一个Unknown column 'full_name' in 'where clause'

最佳答案

两种解决方法:

SELECT concat(first_name, ' ', last_name) as full_name FROM auth_user
WHERE first_name IS NOT NULL and last_name is not null


要么,

select * from (
    SELECT concat(first_name, ' ', last_name) as full_name FROM auth_user)
where full_name is not null

10-01 07:49
查看更多