Migration failed with source plugin exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column I'm trying to migrate user's content profiles (Drupal 6) to Profile2's profiles (Drupal 7) using the example from http://grasmash.com/article/migrate-classes-content-profile-profile2. When I try importing, I get the following error:


  Migration failed with source plugin exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ctp.field_titul_pred_jmenem' in 'field list' 


This is the migration class.

class SkipProfile2Migration extends Migration {
  public function __construct() {
    parent::__construct();
    $this-&gt;description = t('Migration of content profile into profile2 entities');

    $this-&gt;map = new MigrateSQLMap($this-&gt;machineName,
      array(
        'nid' =&gt; array(
          'type' =&gt; 'int',
          'unsigned' =&gt; TRUE,
          'not null' =&gt; TRUE,
          'description' =&gt; 'D6 Unique Node ID',
          'alias' =&gt; 'n',
        )
      ),
      MigrateDestinationNode::getKeySchema(),
        'default'
    );
    $query = Database::getConnection('default', 'legacy')
      -&gt;select('node', 'n')
      -&gt;fields('n', array('nid', 'vid', 'type', 'language', 'title', 'uid', 'status', 'created', 'changed', 'comment', 'promote', 'moderate', 'sticky', 'tnid', 'translate'))
      -&gt;condition('n.type', 'profile', '=');
    $query-&gt;join('skip' . '.node_revisions', 'nr', 'n.vid = nr.vid');
    $query-&gt;addField('nr', 'body');
    $query-&gt;addField('nr', 'teaser');
    $query-&gt;addField('nr', 'format');
    $query-&gt;join('skip' . '.users', 'u', 'n.uid = u.uid');
    $query-&gt;addField('u', 'name');
    $query-&gt;leftJoin('skip' . '.content_type_clovek', 'ctp', 'n.nid = ctp.nid AND n.vid = ctp.vid');
    $query-&gt;addField('ctp','field_titul_pred_jmenem');
    $query-&gt;addField('ctp','field_krestni_jmeno');
    $query-&gt;addField('ctp','field_prijmeni');
    $query-&gt;addField('ctp','field_titul_za_jmenem');
    $query-&gt;addField('ctp','field_telefon');
    $query-&gt;addField('ctp','field_email_source');
    $query-&gt;addField('ctp','field_ulice');
    $query-&gt;addField('ctp','field_cislo_popisne');
    $query-&gt;addField('ctp','field_sidlo');
    $query-&gt;addField('ctp','field_smerovaci_cislo');
    $query-&gt;addField('ctp','field_funkce_cloveka');
    $query-&gt;addField('ctp','field_pracoviste');
    $query-&gt;addField('ctp','field_stat_iso');
    $query-&gt;orderBy('n.nid', 'ASC');

    $source_fields = array(
      'nid' =&gt; t('The node ID of the page'),
      'uid' =&gt; t('The user ID of a user'),
      'lid' =&gt; t('The location ID of a location instance'),
    );

    // Create a MigrateSource object, which manages retrieving the input data.
    $this-&gt;source = new MigrateSourceSQL($query, $source_fields);
    $this-&gt;destination = new MigrateDestinationProfile2('clovek');

// FIELD MAPPINGS    ...


Can anybody help me, please?
On Drupal 6 running CCK, the database field names are different from the CCK field names. 

In my test site running Drupal 6, I created the following CCK fields:


field_code_page (text)
field_co_author (user reference)
field_book_list (node reference)




The database table created from CCK for the content type containing those fields has the following database fields:


field_code_page_value
field_co_author_uid
field_book_list_nid




It is rather probable the database field is named ctp.field_titul_pred_jmenem_value. To be sure, you should check the database table, as the database field could have a different name, basing on the type of the CCK field.