Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with a MySQL query
    primarykey
    data
    text
    <p>I have the following query:</p> <pre><code>SELECT u.uid, pf.title, pv.value FROM users AS u INNER JOIN profile_values AS pv ON pv.uid = u.uid INNER JOIN profile_fields AS pf ON pf.fid = pv.fid ORDER BY u.uid </code></pre> <p>Which results in:</p> <pre><code>uid title value 1 First name Jared 1 Last name Boo 1 Organization Acme 1 Website http://acme.com 1 Country Canada 6 First name Nathan 6 Last name Foo </code></pre> <p>I am attempting to use this result to create another result set which looks like this:</p> <pre><code>uid First name Last name Organization Website Country 1 Jared Boo Acme http... Canada 6 Nathan Foo </code></pre> <p>Am I going about this correctly?</p> <p>Thanks in advance</p> <p><em>EDIT</em></p> <p>Tables:</p> <pre><code>CREATE TABLE `users` ( `uid` int(10) unsigned NOT NULL auto_increment, `name` varchar(60) NOT NULL default '', `pass` varchar(32) NOT NULL default '', `mail` varchar(64) default '', `created` int(11) NOT NULL default '0', `access` int(11) NOT NULL default '0', PRIMARY KEY (`uid`), UNIQUE KEY `name` (`name`), KEY `access` (`access`), KEY `created` (`created`), KEY `mail` (`mail`) ); CREATE TABLE `profile_fields` ( `fid` int(11) NOT NULL auto_increment, `title` varchar(255) default NULL, `name` varchar(128) NOT NULL default '', `explanation` text, `category` varchar(255) default NULL, PRIMARY KEY (`fid`), UNIQUE KEY `name` (`name`), KEY `category` (`category`) ); CREATE TABLE `profile_values` ( `fid` int(10) unsigned NOT NULL default '0', `uid` int(10) unsigned NOT NULL default '0', `value` text, PRIMARY KEY (`uid`,`fid`), KEY `fid` (`fid`) ); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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