Solved

sql server query

Posted on 2016-08-02
3
50 Views
Last Modified: 2016-08-02
I have a table with chords and scale types. I would like to choose a chord for this explanation a "cmin" and return the rows where cmin appears in anyof the columns from 1 to dim7
not sure how to do that


here's example data

ID      ScaleType      i      ii      iii      iv      v      vi      vii      Dim7      Tonic      GridLength
1      Major      C maj      D min      E min      F maj      G maj      A min      B dim      -      C      7
2      Minor      C min      D min      D# maj      F min      G min      G# maj      A# maj      -      C      7
3      Dorian      C min      D min      D# maj      F maj      G min      A dim      A# maj      -      C      7
4      Mixolydian      C maj      D min      E dim      F maj      G min      A min      A# maj      -      C      7
5      Lydian      C maj      D maj      E min      F# dim      G maj      A min      B min      -      C      7
6      Phrygian      C min      C# maj      D# maj      F min      G dim      G# maj      A# min      -      C      7
7      Locrian      C dim      C# maj      D# min      F min      F# maj      G# maj      A# min      -      C      7
8      Diminished      C dim      C# dim      D# dim      E dim      F# dim      G dim      A dim      A# dim      C      8
9      Whole-half      C dim      D dim      D# dim      F dim      F# dim      G# dim      A dim      B dim      C      8
10      Whole Tone      C aug      D aug      E aug      F# aug      G# aug      A# aug      -      -      C      6
11      Minor Blues      C sus      D# min      F sus2      D# min      F sus2      D# min      -      -      C      6
12      Minor Pentatonic      A# sus2      C min      D# sus2      F sus2      D# maj      -      -      -      C      5
13      Major Pentatonic      A min      C sus2      D sus2      C maj      G sus2      -      -      -      C      5
14      Harmonic Minor      C min      D dim      D# Aug      F min      G maj      G# maj      B dim      -      C      7
ee.JPG
0
Comment
Question by:PeterBaileyUk
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 41738810
declare @search as varchar = 'c min'

select
*
from that_table
where  i   = @search
or   ii     =@search
or  iii     = @search
or iv     = @search
or v      = @search
or vi        = @search
or vii        = @search
or Dim7   = @search
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 41738817
thank you
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 41738820
a pleasure, thank you
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

828 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