Let key represent the field name.
Let value reference the data at the 'current' key.

Suppose we have a sample table:

+----+------+------+------+--------+--------+
| id | key0 | key1 | key2 | other1 | other2 |
+----+------+------+------+--------+--------+
|  0 | data | none | none |  data  |  none  |
|  1 | none | none | data |  none  |  data  |
| 10 | data | none | none |  data  |  none  |
| 11 | data | data | none |  data  |  data  |
+----+------+------+------+--------+--------+

How does one:

SELECT key as header FROM table WHERE id = '10' AND value = 'data';

And get:

+--------+
| header |
+--------+
| key0   |
| other1 |
+--------+

Further, would it be possible to:

SELECT key as header FROM table WHERE id = '11' AND value = 'data' AND key =
'key_';

To achieve a list of those field names from the table where the row's id is
'11', the key is key{something}, and the data held in the cell corresponding
to that row and key is 'data'?

Or, in the example above, the results:

+--------+
| header |
+--------+
| key0   |
| key1   |
+--------+

Thanks,
Jeremy


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to