Answers.Body: <p>FeedMe plugin imports categories, so you could create an xml template file that outputs your entries and their checkbox values(separated by commas), then use FeedMe to import that file back in and map those checkboxes to your categories. They just have to match spelling, otherwise FeedMe will create a new category</p>
  
  <p><a href="https://github.com/engram-design/FeedMe" rel="nofollow">FeedMe</a></p>
  
  <p>Something like:</p>
  
  <pre><code>&lt;xml&gt;
    &lt;blog&gt;
      {% for entry in entries %}
        &lt;entry&gt;
          &lt;title&gt;{{ entry.title }}&lt;/title&gt;{# required for import #}
          &lt;category&gt;&lt;![CDATA[{% for option in entry.checkboxFieldHandle %}{{ option }}, {% endfor %}]]&gt;&lt;/category&gt;
        &lt;/entry&gt;
      {% endfor %}
    &lt;/blog&gt;
   &lt;/xml&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T23:04:03.327Z
Answers.Text: ok this doesn't seem to work. I made the xml feed and can access it in the browser. Feed me can pick it up, but when I run the import, the new categories field remains unchanged even when the log says it's successfully updated
Answers.UserDisplayName: ChaiTea
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-26T14:01:15.810Z
Answers.Text: Did you map it to your categories field in FeedMe? A couple of things that slipped me up when I was doing it...1. make sure devMode is off. 2. in the settings of FeedMe, make sure "Primary element" is set(in my case "entry"). Then maybe check your "Import Strategy" is set to Add and Update existing.
Answers.UserDisplayName: AbbeyDesign
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-15T17:58:14.650Z
Answers.Text: Ok finally got this working, a big gotcha is that when selecting import options, I had to choose import title field to the title field, otherwise feed me doesn't know which entry is related to which, and just updates one entry over and over again
Answers.UserDisplayName: ChaiTea
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T00:12:33.243Z
Answers.LastActivityDate: 2016-08-25T00:12:33.243Z
Answers.UserDisplayName: AbbeyDesign
Body: <p>In a project I have a checkbox field called <code>gradeLevels</code> with 3 options (k-5,6-8, and 9-12). </p>
  
  <p>Due to design changes, I need to convert this field into a category field. I've made a new category with the same names (k-5,6-8, and 9-12), but I already have data in all of the entries that uses the old checkbox field.</p>
  
  <p>I poked around in mysql and listed all the columns in craft_fields table, but I don't see the newly created categories field in the list, or any categories/entries field for that matter. I'm guessing associations are stored in a different manner?</p>
  
  <p>Is there a possible way using mysql to map all the string values in the check box fields into the corresponding category in the categories field?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T22:41:57.760Z
Comments.Text: Not a full answer, but category field data (along with all other relational field data - assets, users, entries, etc.) is stored in the `craft_relations` table.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T23:00:18.813Z
Comments.Text: As Brad mentioned, Categories are stored much differently than checkboxes. Doing this purely through SQL queries is risky. How many Entries are you dealing with in total?
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T23:29:54.750Z
Comments.Text: FeedMe plugin imports categories, so you could create an xml template file that outputs your entries and their checkbox values(separated by commas), then use FeedMe to import that file in and map that to your cats. They just have to have the same name or FeedMe will create new ones. Just back up your db! I'm only commenting because I imported categories once on a site and have no real experience trying to do what you want.
Comments.UserDisplayName: AbbeyDesign
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T23:34:15.517Z
Comments.Text: @Lindsey roughly 500 entries. It's okay if I break it during testing because I have many backup copies of the DB. Looks like the checkbox field type is stored as varchar(255)
Comments.UserDisplayName: ChaiTea
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T23:46:05.727Z
Comments.Text: @AbbeyDesign: I was thinking something similar... use Feed Me to create a sort of self-referential loop. I think it's a great idea, you should add it as an official answer!
Comments.UserDisplayName: Lindsey D
Tags: <categories><database><fieldtypes><mysql>
Title: map values from checkbox field into category field using SQL
ThreadText: # map values from checkbox field into category field using SQL
  
  (Asked by: username_0 on 2016-08-24)
  
  In a project I have a checkbox field called `gradeLevels` with 3 options (k-5,6-8, and 9-12).
  
  Due to design changes, I need to convert this field into a category field. I've made a new category with the same names (k-5,6-8, and 9-12), but I already have data in all of the entries that uses the old checkbox field.
  
  I poked around in mysql and listed all the columns in craft\_fields table, but I don't see the newly created categories field in the list, or any categories/entries field for that matter. I'm guessing associations are stored in a different manner?
  
  Is there a possible way using mysql to map all the string values in the check box fields into the corresponding category in the categories field?
  
  **Tags:** categories, database, fieldtypes, mysql
  
  > **Comments:**
  > **username_1**: Not a full answer, but category field data (along with all other relational field data - assets, users, entries, etc.) is stored in the `craft_relations` table.  
  > **username_2**: As username_1 mentioned, Categories are stored much differently than checkboxes. Doing this purely through SQL queries is risky. How many Entries are you dealing with in total?  
  > **username_3**: FeedMe plugin imports categories, so you could create an xml template file that outputs your entries and their checkbox values(separated by commas), then use FeedMe to import that file in and map that to your cats. They just have to have the same name or FeedMe will create new ones. Just back up your db! I'm only commenting because I imported categories once on a site and have no real experience trying to do what you want.  
  > **username_0**: @username_2 roughly 500 entries. It's okay if I break it during testing because I have many backup copies of the DB. Looks like the checkbox field type is stored as varchar(255)  
  > **username_2**: @username_3: I was thinking something similar... use Feed Me to create a sort of self-referential loop. I think it's a great idea, you should add it as an official answer!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2016-08-25. Score: 3 | Accepted answer
  
  FeedMe plugin imports categories, so you could create an xml template file that outputs your entries and their checkbox values(separated by commas), then use FeedMe to import that file back in and map those checkboxes to your categories. They just have to match spelling, otherwise FeedMe will create a new category
  
  [FeedMe](https://github.com/engram-design/FeedMe)
  
  Something like:
  
  ```
  <xml>
    <blog>
      {% for entry in entries %}
        <entry>
          <title>{{ entry.title }}</title>{# required for import #}
          <category><![CDATA[{% for option in entry.checkboxFieldHandle %}{{ option }}, {% endfor %}]]></category>
        </entry>
      {% endfor %}
    </blog>
   </xml>
  
  ```
  
  > **Comments:**
  > **username_0**: ok this doesn't seem to work. I made the xml feed and can access it in the browser. Feed me can pick it up, but when I run the import, the new categories field remains unchanged even when the log says it's successfully updated  
  > **username_3**: Did you map it to your categories field in FeedMe? A couple of things that slipped me up when I was doing it...1. make sure devMode is off. 2. in the settings of FeedMe, make sure "Primary element" is set(in my case "entry"). Then maybe check your "Import Strategy" is set to Add and Update existing.  
  > **username_0**: Ok finally got this working, a big gotcha is that when selecting import options, I had to choose import title field to the title field, otherwise feed me doesn't know which entry is related to which, and just updates one entry over and over again  
  
  ---
  
  