Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    I think you should normalise your database. Repeating columns should not be done that way. Take a look at First Normal Form. Commented Apr 27 at 17:38
  • That being said, these columns technically do not repeat. It is just that I do not exactly know what column holds the data value because someone had the bright idea of not enforcing template rules on the data when they represent nothing similar to each other. Commented Apr 27 at 17:41
  • 1
    It depends on the dialect of SQL. PostgreSQL, for example would support WHERE 'val' IN (col1, col2, ..., coln) So, which, RDBMS are you using? Commented Apr 27 at 17:52
  • 1
    @MatBailie Snowflake. PS: That still wouldn't get me out of having to write 68 column names (which are not short... because why would they be?... sigh). Commented Apr 27 at 17:57
  • I guess the real question would be why do you have 68 columns in the first place. Perhaps your table should be redesigned unpivoted to begin with. That would get you out of having to write so many ORs though, even if you have to write the actual names. Commented Apr 27 at 18:38