I thought I was pretty good at following most questions but Jeremy has 
lost me. Jeremy, you were TOO vague (which is good to keep your design 
secret but horrible when asking for help). 

This is what I understood:
a) You have a table with 5 columns.
b) You want to run a query that doesn't name any column in your table and 
alias your results as something else.
c) You want to get the columns' names as the results to queries based on 
certain conditions.

My responses based on my understanding:

a) That was sample data in an example table.
b) This is totally impossible as you must either return a column value or 
the results of function(s) applied to column value(s).
c) I do not understand the usefulness of this method.  What questions are 
you trying to answer? What use does the column names provide that the data 
doesn't?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


"Jeremy McEntire" <[EMAIL PROTECTED]> wrote on 09/07/2004 12:24:07 PM:

> 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