I am trying to solve this below query from one day but i didn’t get the out put..
Query is:
select distinct L.LeadBudget,L.CompanyName,L.LeadTitle,L.Status,
E.Name as OwnerName,E.Name as
CreatedUser
from Leads L,Employee E where L.LeadId='2'
and E.EmployeeId=L.LeadOwner and E.EmployeeId=L.CreatedUserId
In The above query i want to get
E.Name as OwnerName and E.Name as CreatedUser
from a single Employee tables)..where E.EmployeeId=L.LeadOwner and
E.EmployeeId=L.CreatedUserId
if i execute with out OwnerName or Created User i am getting the data..but i want to get both the names.
I would suggest to use a more modern JOIN style; instead of listing multiple talbes and doing everything in the WHERE.
Basically to achiev what you want to do you will need to perform a JOIN for both employees.