Solved

sql server query

Posted on 2016-08-02
3
27 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now