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

  • Home
  • SEARCH
  • 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 8102415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:14:11+00:00 2026-06-05T23:14:11+00:00

I have these tables: table_a user_id article_id created_at articles user_id created_at … I need

  • 0

I have these tables:

table_a

user_id
article_id
created_at

articles

user_id
created_at
...

I need to obtain all rows from both tables for the respective user (lets say user_id=1) and sorted them by the column created_at. How to do that?

I have tried to do it this way:

Model.find_by_sql('SELECT table_a.* FROM table_a JOIN articles ON articles.user_id = 1 WHERE table_a.user_id = 1')

But this query won’t work.

  • 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-05T23:14:12+00:00Added an answer on June 5, 2026 at 11:14 pm

    I would give a try to following query:
    SELECT table_a.*, articles.*
    FROM table_a JOIN articles ON articles.user_id = table_a.user_id
    WHERE table_a.user_id = 1
    ORDER BY table_a.created_at ASC;

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

Sidebar

Related Questions

Let's say, we have these SQL tables: [Articles] bill int (pkey) arti int (pkey)
I have a cms which stores comments against articles. These comments can be both
I have this query SELECT articles.*, users.username AS `user` FROM `articles` LEFT JOIN `users`
I have 2 tables. Table 1 is 'articles' and Table 2 is 'article_categories'. When
I have a case where I need to translate (lookup) several values from the
I have 4 tables. Users, Articles, Langs, LangList Articles table: ..., uid (Users.id), lang
I have a table that contains id, created, user_id. I'm wondering if there is
Imagine I have these columns in a table: id int NOT NULL IDENTITY PRIMARY
Say I have a database called Poll and have these two table structures. poll
My table cells have a font-size of 9pt. Within these table cells there is

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.