Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2013
    Posts
    1

    Unanswered: How to get column name based on value in sqlite

    Hi i need to know how to get a column name if a certain value is found in that row.

    For example I have a table such as:

    |Name | Column1 | Column2 | Column3|
    |-----------------------------------|
    |Peter | 100 | 120 | 92 |
    |-----------------------------------|
    |James | 110 | 105 | 88 |
    |-----------------------------------|
    |David | 90 | 112 | 98 |

    I want to do a query of Peter where the value is 92 and I need the query to return Column3.

    Anyone know if sqlite is capable of this?

    I know very basic sql and have not really used sqlite to understand it in depth.

    Thanks for any help

  2. #2
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    Not sure if I understand your request but try this:
    Code:
    select column3 from your_table_name where name = 'Peter' and Column3 = 92

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
  •