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 8777789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:21:44+00:00 2026-06-13T19:21:44+00:00

I have 1 table with tasks named opentask: columns: id,title,description,expires,creator_id,creator_name, executer_id, executer_name, priority_id, status_id

  • 0

I have 1 table with tasks named opentask:
columns: id,title,description,expires,creator_id,creator_name, executer_id, executer_name, priority_id, status_id
1 table with users named user:
with columns: user_id, username
What I want is to create a query where there will be all columns from opentask table where the executer_id will be equal to the user_id of user table AND the creator_id will be equal to the user_id again. This creates a confusion because the first equality excludes the second.

So I need somehow to create a query where I will include the usernames for the executer with something like where “opentask.executer_id=user_user_id” and at the same time I will include the username again (as a differend name?) for the creator with something like “where opentask.executer_id=user_user_id”

So I try this, which of course I know that is missing something, can you help?

SELECT DISTINCT id, title, description, expires, creator_id, executer_id, oc_opentask.priority_id, oc_opentask.status_id, priority_name, status_name, user_id, username, (SELECT username FROM oc_opentask, oc_user WHERE oc_opentask.creator_id=oc_user.user_id) AS username2 FROM oc_opentask, oc_opentask_priority, oc_user, oc_opentask_status WHERE oc_opentask.priority_id=oc_opentask_priority.priority_id AND oc_opentask.executer_id=oc_user.user_id AND oc_opentask.status_id=oc_opentask_status.status_id ORDER BY oc_opentask.expires DESC

  • 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-13T19:21:45+00:00Added an answer on June 13, 2026 at 7:21 pm

    ReJOIN the table oc_user twice with different aliases creators and executers like so:

    SELECT DISTINCT 
      t.*, 
      creators.user_name 'Creator name',
      executers.username 'Executor name', 
      tp.priority_name, 
      s.status_name
    FROM oc_opentask t 
    INNER JOIN oc_opentask_priority tp        ON t.priority_id = tp.priority_id
    INNER JOIN oc_user              executers ON t.executer_id = executes.user_id
    INNER JOIN oc_user              creators  ON t.creator_id  = creators.user_id
    INNER JOIN oc_opentask_status   s         ON t.status_id   = s.status_id
    ORDER BY t.expires DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table (named tasks ) with column created_at that, basically, contains UNIX time-stamp.
The parameters are thus: I have a table called Tasks with columns ID (primary
i have 2 table named projects and tasks in projects table i have: id
I have a MySQL database includes a table named 'Task'. and I used Hibernate
I have a table of 3-4 columns, the central one being task names that
I have a tasks table with a priority column, which has a unique constraint.
I have a table called TPM_TASKS which contain all tasks, as well as a
I have one table named task_assignment . It has following 6 fields named as:
I have a table named books with bookID, bookName, count , orderCount i'd like
Okay, I'll simplify this post. I have a table tasks containing, for example, a

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.