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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:58:18+00:00 2026-06-05T22:58:18+00:00

Here is my MySQL Query that im trying to execute. it keeps failing with

  • 0

Here is my MySQL Query that im trying to execute. it keeps failing with the error:
Unknown column ‘staff_tbl.mainrank’ in field list. how is this possible?

DROP TEMPORARY TABLE IF EXISTS `staff_tbl`;
CREATE TEMPORARY TABLE staff_tbl(childrank TEXT, mainrank TEXT);

INSERT INTO staff_tbl
SELECT permissions_inheritance.child, permissions_inheritance.parent 
FROM permissions_inheritance;

SELECT      authme.username, permissions_inheritance.child,     
permissions_inheritance.parent, staff_tbl.mainrank
FROM        authme 
INNER JOIN  permissions_inheritance ON authme.username = permissions_inheritance.child
INNER JOIN  staff_tbl alies2 ON staff_tbl.mainrank = permissions_inheritance.parent;


DROP TABLE `staff_tbl`;

I would greatly appreciate if you could help me. i have pulled every bit of my hair out. so you guys are my last hope. Im still a novice 🙂

  • 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-05T22:58:19+00:00Added an answer on June 5, 2026 at 10:58 pm

    In the last SELECT you have the last join wrong. You make a join with staff_tbl and give it an alias (alies2). You must use that alias in the statement that follows (alies2.mainrank = permissions_inheritance.parent instead of staff_tbl.mainrank = permissions_inheritance.parent), you didn’t.

    Try writing your last SELECT like this:

    SELECT      a.username, p.child, p.parent, s.mainrank
    FROM        authme a
    INNER JOIN  permissions_inheritance p ON a.username = p.child
    INNER JOIN  staff_tbl s ON s.mainrank = p.parent;
    

    I fixed this above. I also set an alias for each table to make the query shorter and therefore more readable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following MySQL query that I'm trying to translate into an equivalent
I am trying to execute an INSERT query in a mysql DB, but it
Here is the query I'm trying to execute, and it's supposed to return a
I am having trouble getting well formatted results from my mysql query. Here is
I have a problem with (for me to complicated) MySql query. Okay, here is
I have this query which works correctly in MySQL. More background on it here
I am trying to execute a query on a table in my SQL Server
I am trying to do an INSERT into MySQL using the cursor.execute(sql, args) syntax.
I'm trying to run a simple query with an ORM that is built on
I have a fairly complex query (it takes about 30 seconds to execute) that

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.