How to return null value if the query has no corresponding value?
- by Holicreature
Hi
i've a query
select c.name as companyname, u.name,u.email,u.role,a.date from useraccount u,
company c, audittrial a where u.status='active' and u.companyid=c.id and
(u.companyid=a.companyID and a.activity like 'User activated%' and
a.email=u.email) order by u.companyid desc limit 10
So if the following part doesnt't satisfy,
(u.companyid=a.companyID and a.activity like 'User activated%' and
a.email=u.email)
no rows will be returned..
but i want to return the result of the following query
select c.name as companyname, u.name,u.email,u.role,a.date from useraccount u,
company c, audittrial a where u.status='active' and u.companyid=c.id order by
u.companyid desc limit 10
but to add that, i should return the date if available and return null value if date is not available..
how can i do this?