Solved

sql server query

Posted on 2016-08-02
3
61 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

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 49

Expert Comment

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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

717 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