?
Solved

check 15 fields in Oracle table = '15'  - SQL

Posted on 2014-03-24
2
Medium Priority
?
361 Views
Last Modified: 2014-03-24
Experts,

I would like to know if there is a way to check msgno1 - msgn015 to see if any have a value of equal to '15' and use this is a selection criteria in a where statement if Oracle SQL.

If anyone of the respective 15 fields has a value of '15', I want to select the record if not I don't.
0
Comment
Question by:morinia
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 39950810
SELECT *
  FROM yourtable
 WHERE '15' IN (msgno1,
                msgno2,
                msgno3,
                msgno4,
                msgno5,
                msgno6,
                msgno7,
                msgno8,
                msgno9,
                msgno10,
                msgno11,
                msgno12,
                msgno13,
                msgno14,
                msgno15)
0
 
LVL 36

Expert Comment

by:ste5an
ID: 39950826
Normalize your table?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question