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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:58:37+00:00 2026-06-06T15:58:37+00:00

I am using Ruby on Rails 3.2.2 and MySQL. I have a method (an

  • 0

I am using Ruby on Rails 3.2.2 and MySQL. I have a method (an has_many :through ActiveRecord::Associations) that generates the following SLQ query:

SELECT DISTINCT `articles`.*
           FROM `articles`
     INNER JOIN `articles_comments_associations` `comment_associations_articles`
             ON `comment_associations_articles`.`article_id` = `articles`.`id`
     INNER JOIN `articles_comments_associations`
             ON `articles`.`id` = `articles_comments_associations`.`article_id`
          WHERE `articles_comments_associations`.`comment_id` = 223
            AND (articles_comments_associations.user_id IN (2))

I would like to understand what it means INNER JOIN 'articles_comments_associations' 'comment_associations_articles' (note: there are multiple database table statements for the INNER JOIN) and how it is possible that the SQL query works since I do not have a database table named comment_associations_articles. Is it an error (even if it works as expected)?

  • 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-06T15:58:39+00:00Added an answer on June 6, 2026 at 3:58 pm

    It is a table alias. Meaning, it is renaming the table articles_comments_associations to comment_associations_articles for the purpose of further references in the query. Any field or table can be aliased by simply giving another name following the table/field reference.

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

Sidebar

Related Questions

I have a deployment using: rails 2.3.2 ruby 1.8.7 mysql db and 3 mongrel
I have a couple of scripts that interact with a MySQL database using ActiveRecord
I am using Mysql 5 and Ruby On Rails 2.3.1. I have some validations
I am using ruby on rails with a MySQL backend. I have a table
I have Ruby on Rails application which is using MySQL database. For now I'm
I am using Ruby on Rails and have a situation that I am wondering
I'm using ruby on rails 2.3.2 and also using the acts_as_taggable_on puglin. That generated
I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0, rspec-rails-2.8.1, capybara-1.1.2 and factory_girl-2.6.3. I have
I am attempting to remotely connect to a MySQL database using ruby on rails.
I have a Ruby on Rails application that has two active environments, Stage and

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.