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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:01:58+00:00 2026-05-10T23:01:58+00:00

I have a relationship between two tables, authors and styles. Every author is associated

  • 0

I have a relationship between two tables, authors and styles. Every author is associated with a style, with the special case where an author doesn’t have a style (IS NULL).

There’s no problem in setting the reference to NULL, but there’s a problem doing a query to select the authors and styles.

For example, the query:

SELECT 'authors'.'id', 'authors'.'name', 'styles'.'name', 'authors'.'comments' FROM  'authors' , 'styles' WHERE 'authors'.'style' = 'styles'.'id' 

just ignores the authors that have a NULL style (as expected).

I need to do a select that also lists authors with NULL style, like a left join would do (I can’t use LEFT JOIN fo some reasons).

There’s a solution that doesn’t include explicit joins?

  • 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. 2026-05-10T23:01:59+00:00Added an answer on May 10, 2026 at 11:01 pm

    The most obvious solution is a LEFT OUTER JOIN.

    See: http://www.postgresql.org/docs/8.1/static/tutorial-join.html

    If you don’t want to use explicit joins you should be able to use a UNION

    SELECT 'authors'.'id', 'authors'.'name', 'styles'.'name', 'authors'.'comments' FROM  'authors' , 'styles' WHERE 'authors'.'style' = 'styles'.'id' UNION SELECT 'authors'.'id', 'authors'.'name', '', 'authors'.'comments' FROM  'authors' WHERE 'authors'.'style' IS NULL 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a one to many relationship between two tables. The many table contains
I have two tables. Club and Coach. Between them is 0,1 - 0,1 relationship
I have a relationship between two tables. The two tables PKs are int types.
If I have a relationship between two tables (both tables have their own primary
I have a 1:1 relationship between two tables. I want to find all the
I have a many-to-many relationship between two tables: Order and Item. I need to
I have two tables: messages (messages users posted), likes (many to many relationship between
I have two tables in my rails application Categories and Projects. The relationship between
I have two tables in my Sybase database A and B. The relationship between
I have two tables, a and b, and want to create a m:n-relationship between

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.