Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9257983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:16:42+00:00 2026-06-18T12:16:42+00:00

I am trying to solve this below query from one day but i didn’t

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:16:43+00:00Added an answer on June 18, 2026 at 12:16 pm

    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.

    SELECT l.LeadBudget, l.CompanyName, l.LeadTitle, l.Status, leadEmp.Name As OwnerName, createdEmp.Name As CreatedUser
    FROM Leads l
         INNER JOIN Employee leadEmp ON(l.LeadOwner = leadEmp.EmployeeId)
         INNER JOIN Employee createdEmp ON(l.CreatedUserId= createdEmp.EmployeeId)
    WHERE l.LeadId='2' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to solve this problem. I have a series of SELECT statements
I am trying to use the below query in a stored procedure to get
I am trying to solve this error, but failed miserably. I have declared my
I didn't have much luck finding out much about this one… I have an
I was trying to solve this homework assignment but was unable to come up
This is one annoying issue and I can't figure out how to solve it.
I am new to Java and trying to solve the problem below So this
I am trying to run the following script (unsuccessfully): $variables = $db->query(SELECT * FROM
I'm pulling my hair out trying to solve this (hopefully) simple problem. I am
I've been trying to solve this problem all day. I just want to list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.