Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    25

    Unanswered: Filter to show just one column value

    Hello,
    I am relative new with Mysql.
    I try to made one query but not see how.
    I have table with 25 columns. Have three filter criteria. First for first column (so row filter), second for second column (so row filter). Third criteria have to filter and in the end show just column with value of that column.

    Let go with example. After filtered with criteria 1 and 2 i receive for example this kind of table with in first line column name

    Country A B C D E
    USA 11 21 31 41 51
    France 12 22 32 42 52
    Germany 13 23 33 43 53
    Italy 14 24 34 44 54
    Spain 15 25 35 45 55

    And my last criteria 3 is to show for example only column D (this can change so how to made query with this criteria 3), so results to be this list
    41
    42
    43
    44
    45

  2. #2
    Join Date
    Oct 2014
    Posts
    291
    Provided Answers: 7
    SELECT
    A.D

    FROM
    (

    SELECT
    COUNTRY
    , A
    , B
    , C
    , D
    , E

    FROM YOURTABLE
    ) AS A
    I don't really understand your requirements. You could built a base query filtering for 1 and 2 and then wrap an outer query just reflecting column D or you could should comment out the columns you don't need and execute the query.
    70-461 SQL Certified.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •