At 11:24 -0500 9/7/04, Jeremy McEntire wrote:
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 |
+--------+

You cannot SELECT the column name and have it be part of the result set. Column names are part of the metadata; you can get them if you use an API that provides the metadata.


-- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MySQL AB, www.mysql.com

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



Reply via email to