but,the query cannot run on my mysql 4.0.23
See http://dev.mysql.com/doc/mysql/en/rewriting-subqueries.html
for how to get round the unavailability of subqueries before version
4.1.
PB
-
维斯 苏 wrote:
thank you
but after i read it, I try the second example
Pivot table using a JOIN
Hello.
Your question isn't clear enough for me. Do you want that values
in 'type' column of the first table to become column names
in the second table? Or do you want just to see results in a row?
$$ $ [EMAIL PROTECTED] wrote:
[-- text/plain, encoding 8bit, charset: gb2312, 17 lines
Hello.
I want the values in the 'type' column of the first table to be the
column name in the second table.
Please, answer next time to the list as well. In my opinion, it is
easier to prepare the create statement on the client side than
on the server. And does this table have any sense,
Hello.
Please, answer next time to the list as well. In my opinion, it is
easier to prepare the create statement on the client side than
on the server. And does this table have any sense, considering the
relational model?
Sorry,I think you misunderstand my purpose,table2 is my query result,in
My table is:
type price
car 1000
bike 100
I want the result:
car bike
1000 100
You seem to want to turn rows into columns. That's often called a
"pivot
table". There's a step-by-step for pivot tables at
http://www.artfulsoftware.com/queries.php#24. There're other pivot
table examples on the