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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:18:26+00:00 2026-05-15T23:18:26+00:00

My schema looks something like this: CREATE TABLE plans ( id SERIAL PRIMARY KEY,

  • 0

My schema looks something like this:

CREATE TABLE plans (
    id SERIAL PRIMARY KEY,
    description text
);

CREATE TABLE projects (
    id SERIAL PRIMARY KEY,
    project_id character varying(240) UNIQUE,
    plan_id integer REFERENCES plans(id) ON DELETE CASCADE
);

And I want to do Storm queries along the lines of

plan = store.find(Plan, Plan.project_id == "alpha")
# should translate to something like
# SELECT p.* from plans p LEFT JOIN projects proj ON p.id = proj.plan_id
#     WHERE proj.project_id = 'alpha';

(Note that projects.plan_id is not unique.)

How do I set this up?

  • 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-15T23:18:27+00:00Added an answer on May 15, 2026 at 11:18 pm

    For the given SQL, there isn’t much reason to use a left join, since your where clause won’t match any rows where there isn’t a corresponding project. You could get the results with:

    result = store.find(Plan, Plan.id == Project.plan_id, Project.project_id == "alpha")
    

    This will give you a ResultSet object. Given your schema, it looks like you’re expecting a single row, so you can access that with:

    plan = result.one()
    

    Or tie them both together with:

    plan = store.find(Plan, Plan.id == Project.plan_id, Project.project_id == "alpha").one()
    

    If you really need to do a left join, the syntax for that would be something like this:

    result = store.using(LeftJoin(Plan, Project, Plan.id == Project.plan_id)).find(
        Plan, Project.project_id == "alpha")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Spawn a new process. May 16, 2026 at 10:25 am
  • Editorial Team
    Editorial Team added an answer Tapestry-Security is just a thin layer on top of the… May 16, 2026 at 10:25 am
  • Editorial Team
    Editorial Team added an answer Replace your UITableViewController with a UIViewController. Then add a UITableView… May 16, 2026 at 10:25 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a table with this schema: DeviceID int RoomID int DateInstalled datetime A
I have some Oracle tables that represent a parent-child relationship. They look something like
I wrote the database schema (only one table so far), and the INSERT statements
I'm newish to NHibernate, and am attempting to wire up to a DB2 table
I'm a bit new to rails so if this is very basic please bear
OK so I've been tasked with upgrading an application which involves updating schema in
I want to empty a temporary table, load it via bcp, and then modify
I have a sqlite3 db in a rails app with the following schema ActiveRecord::Schema.define(:version
I'm working on a catalog site where users can browse categories. Categories can contain
I've got a curious puzzle with an object-relational mapping, using Java and Hibernate. We

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.