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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:24:22+00:00 2026-06-04T12:24:22+00:00

this is not a real example, it is something that has been bugging me

  • 0

this is not a real example, it is something that has been bugging me for some time, and I’d be very thankful to anyone who can explain this behavior.

I have these two tables

MYTABLE1
ID  TYPE    NAME 
1   1       typea
2   2       typea
3   3       typea
4   4       typeb
5   5       typeb
6   6       typeb
7   7       typec
8   8       typec
9   9       typec
10  10      typed

MYTYPE
ID  NAME    DESCRIPTION
1   typea   typea with desc
2   typea   
3   typea   TYPE
4   typeb   typeb with desc
5   typeb   
6   typeb   TYPE
7   typec   typec with desc
8   typec   
9   typec   TYPE

I’d like to have a sql that returns rows from both tables (mytable1 a, mytype b) where

a) MYTABLE1.type = MYTYPE.ID and MYTYPE.description=’TYPE’

b) MYTABLE1.type is not in MYTYPE.id

a.id    a.type  a.name  b.id    b.name  b.description
3       3       typea   3       typea   TYPE
6       6       typeb   6       typeb   TYPE
9       9       typec   9       typec   TYPE
10      10      typed   null    null    null

I have tried this statements with no success. I want a solution that uses outer joins, not unions or nested selects.

For the example, I am using Oracle outer join syntax but I think the same result can be achieved by using standard syntax and putting the condition a) inside the ON clause or b)in the where clause

What I’d like is to understand the “strange” behaviour of them, and try to find one that works for the example provided.
Most strange for me it is SQL2. I am not writing the results of the queries, to keep the question shorter, but I can provide them if needed.

SQL1

select * 
from 
  mytable1 a,
  mytype b
where
  a.type=b.id(+)
  and b.description ='TYPE'
order by a.id

SQL2

select * 
from 
  mytable1 a,
  mytype b
where
  a.type=b.id(+)
  and b.description(+) ='TYPE'
order by a.id

SQL3

select * 
from 
  mytable1 a,
  mytype b
where
  a.type=b.id(+)
  and (b.description ='TYPE' or b.description is null)
order by a.id

Thanks in advance,

  • 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-04T12:24:24+00:00Added an answer on June 4, 2026 at 12:24 pm

    Stop using old Cartesian product syntax. JOIN syntax is the ANSI-92 standard. 20 years should be enough to be considered stable…

    SELECT
      *
    FROM
      myTable1    a
    LEFT JOIN
      myType      b
        ON b.id = a.type
    WHERE
         b.description = 'TYPE'
      OR b.id IS NULL
    

    NOTE: I did have b.description IS NULL but, as far as I recall, ORACLE treats 0 length strings as NULL. Therefore it is better to test the id field for a case of No Join.

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

Sidebar

Related Questions

Something that has been bugging me since I read an answer on another stackoverflow
Has anyone been able to successfully unit test methods that are, by necessity, coupled
Note: this is not real information: $ ssh-keygen -t rsa -C "tekkub@gmail.com" Generating public/private
This is not a real bug BUT for sure it is not what you
If this is not a real question then feel free to close ;)
Update: This issue was not properly explored. The real issue lies within render :json
So why is this not working? I'm creating a regex that will match a
This probably has probably been asked before, but I couldn't find anything relevant. Would
I have a simple class in python that has a __str__() function. Like this:
here's real example that will lead to my question: I have an AddCommentToArticleCommand, which

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.