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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:51:08+00:00 2026-05-29T03:51:08+00:00

I am trying to write this SQL: SELECT a.a_id as aid, b.b_id as bid

  • 0

I am trying to write this SQL:

SELECT  
   a.a_id as aid,  
   b.b_id as bid ,  
   c.title  
FROM b ,  
   ( SELECT  
       a.a_id
     FROM a  
     WHERE a.type = '2'  
   ) AS a  
LEFT JOIN c ON b.b_id = c.c_id

If I don’t put a reference to the LEFT JOIN or the select c, then it works. If I do put the left join, then I get an error that the b.b_id is an unknown column. Why can’t I use a left join here or more specifically, why is any column in table b unknown? The first part of the statement is a normal select from table b, so why can’t it find those columns?

When do you use subqueries versus inner joins? In this example:

  • Table a contains fixed length flags (a bunch of integers) with information about topics
  • Table c contains things like topic title, etc.
  • Table b contains the category information.

What I am trying to accomplish is to pull all categories of a certain type (table a), and also pull all topic titles (table c) where the category id is the same as what it is defined for the topic id (table b).

  • 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-05-29T03:51:09+00:00Added an answer on May 29, 2026 at 3:51 am

    If you interchange table “a” with “b” the sql compiles (but does this give the results you seek?):

    SELECT  
       a.a_id as aid,  
       b.b_id as bid,  
       c.title  
    FROM  
       ( SELECT  
           a.a_id
         FROM a  
         WHERE a.type = '2'  
       ) AS a, b  
    LEFT JOIN c ON b.b_id = c.c_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a query for a database that will left join a
I'm trying to write this query using Hibernate 3 and Oracle 10. from Alert
I am trying to write a SQL query that returns rows from a table
I'm trying to write some simple C# code that will select some data from
I'm trying to write a sql function to do something like: SELECT person.id, person.phonenumber
I am trying to write a SQL Statement for Interbase. Whats wrong with this
I am trying to write a select query from one single table in SQLite
All, I'm trying to write a sql statement to be something like this: $sql
I'm trying to figure out how to write this function: template <typename Bound> Bound::result_type
I could probably write this myself, but the specific way I'm trying to accomplish

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.