From: Peter Brawley Date: August 17 2005 4:22am Subject: Re: how to arrange my table in another direction List-Archive: http://lists.mysql.com/mysql/187940 Message-Id: <4302BB74.4090806@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======AVGMAIL-4302BB767367=======" --=======AVGMAIL-4302BB767367======= Content-Type: multipart/alternative; boundary=------------070803050607090004040302 --------------070803050607090004040302 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit />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 same page. PB --------------070803050607090004040302 Content-Type: text/html; charset=GB2312 Content-Transfer-Encoding: 7bit >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 same page.

PB --------------070803050607090004040302-- --=======AVGMAIL-4302BB767367======= Content-Type: text/plain; x-avg=cert; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.10/73 - Release Date: 8/15/2005 --=======AVGMAIL-4302BB767367=======--