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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:26:14+00:00 2026-06-15T16:26:14+00:00

Why is sm.status_id and sm.user_id getting an unknown column error? I don’t usually use

  • 0

Why is sm.status_id and sm.user_id getting an unknown column error? I don’t usually use the JOIN keyword for table joins.

...
FROM questions q, connections sm
JOIN users u ON q.user_id = u.id
JOIN users lu ON q.last_user = lu.id
JOIN (SELECT q2.id FROM questions q2 WHERE q2.status_id = sm.status_id LIMIT 2) x ON x.id = q.id
WHERE sm.user_id = 38
GROUP BY th.id
  • 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-15T16:26:15+00:00Added an answer on June 15, 2026 at 4:26 pm

    You have a few issues with your current query.

    First, you are mixing JOIN syntax. You have both comma separated values and then joins with an ON condition.

    Second, you are attempting to access an alias for a table in an inner subquery which you cannot do.

    My suggestion is to try something like this:

    FROM questions q
    JOIN users u 
        ON q.user_id = u.id
    JOIN users lu 
        ON q.last_user = lu.id
    JOIN 
    (
        SELECT q2.id 
        FROM questions q2 
        JOIN connections sm
            ON q2.status_id = sm.status_id 
        WHERE sm.user_id = 38
        LIMIT 2
    ) x ON x.id = q.id
    GROUP BY th.id
    

    You did not post your SELECT list but if you want to include fields from the connections table in the select list then you will need to join on it again or include the fields in the subquery.

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

Sidebar

Related Questions

I'm trying to join a couple of tables where table videos has: video_id user_id
I'm getting this error in my cakephp application Warning (512): SQL Error: 1054: Unknown
I'm getting this error when trying to update the customer_id column in my users
Say I have a 'user_log' table with the following field: id user_id status_text timestamp
This is the code I have : $sqlz = SELECT t1.user_id, t2.status, t2.email FROM
for the table below tenant_id | status_id ---------------------- 3 | 6 --------------------- 5 |
i am getting the error as shown below : Msg 156, Level 15, State
Can someone help me correct the following error I keep getting when trying to
hi i have an Mysql table as follow, post_id | user_id | status |
I am getting an error Started POST /actions for 127.0.0.1 at 2012-10-29 15:04:01 +0600

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.