Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate a summary result with one query
    text
    copied!<p>I have a table with the following format.</p> <pre><code>mysql&gt; describe unit_characteristics; +----------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | uut_id | int(10) unsigned | NO | PRI | NULL | | | uut_sn | varchar(45) | NO | | NULL | | | characteristic_name | varchar(80) | NO | PRI | NULL | | | characteristic_value | text | NO | | NULL | | | creation_time | datetime | NO | | NULL | | | last_modified_time | datetime | NO | | NULL | | +----------------------+------------------+------+-----+---------+----------------+ </code></pre> <p>each uut_sn has multiple characteristic_name/value pairs. I want to use MySQL to generate a table</p> <pre><code>+----------------------+-------------+-------------+-------------+--------------+ | uut_sn | char_name_1 | char_name_2 | char_name_3 | char_name_4 | ... | +----------------------+-------------+-------------+-------------+--------------+ | 00000 | char_val_1 | char_val_2 | char_val_3 | char_val_4 | ... | | 00001 | char_val_1 | char_val_2 | char_val_3 | char_val_4 | ... | | 00002 | char_val_1 | char_val_2 | char_val_3 | char_val_4 | ... | | ..... | char_val_1 | char_val_2 | char_val_3 | char_val_4 | ... | +----------------------+------------------+------+-----+---------+--------------+ </code></pre> <p>Is this possible with just one query?</p> <p>Thanks, -peter</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload