PL/SQL (MOSC)

MOSC Banner

How to exclude sub type in a SQL query?

edited Jun 18, 2015 2:44PM in PL/SQL (MOSC) 5 commentsAnswered ✓

Hi there,

My question could be stupid to ask but I like to create a SQL query for following situation:  I have two types and some sub_types (we don't know what we have here) in a table X:

Type A (sub_type 1, 2, 3, 4)

Type B (sub_type 1, 2, 3)

I want to select the type that without sub_type 4, such as type A.

select type from X where

1. sub_type <> 4, which will give me both type A and B

2. sub_type in (1, 2, 3), which gives me both type A and B as well

Any suggestions? 

Thanks,

Ning

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center