Retrieval of information from table based on column name and values in column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Potts
    New Member
    • Apr 2012
    • 1

    #1

    Retrieval of information from table based on column name and values in column

    I am trying to retrieve information from a table based on a column name (ex. 6187A1) and the I only want to retrieve the information from that column that has a value of "1". I will use this information to find me only the "Comp" that is required.

    (Comp) (6187A1) (6187A2)
    (BZ401) (1) (1)
    (C1) (1) (1)
    (C101) (0) (0)
    (C11) (1) (1)
    (C13) (1) (1)
    (C168) (0) (0)
    (C17) (1) (1)
    (C201) (1) (1)
    (C202) (1) (1)
    (C205) (0) (0)
    (C210) (1) (1)
    (C211) (0) (0)
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You need to learn basic SQL
    Code:
    SELECT [Comp]
    FROM tableName
    WHERE [6187A1] = 1
    Also, it looks like your data is not normalized.

    Comment

    Working...