title: Typo3 foreign_table & foreign_table_where in TCA
body: <p>I am struggling with the following problem. </p>
  
  <p>I have two database tables, "Books" and "Category". I am getting all the data from "books"-table via Sysfolder in Backends List-view for editing, sorting and controlling them. </p>
  
  <p>What I would like to get, is that there would be in that list view also the name of the category where the book belongs.</p>
  
  <p>In "Books"-table there is a field foreign-key <code>"category_id"</code> which defines that for which category the Book belongs. I have tried via this <code>"category_id"</code> to get the name of the Category in List-view of the Books.</p>
  
  <p>When I define in <code>TCA['books']</code> that <code>category_id</code> like:</p>
  
  <pre><code>'category_id' =&gt; array (        
              'exclude' =&gt; 0,     
              'label' =&gt; 'Cat name',      
              'config' =&gt; array (
                  'type'     =&gt; 'select',
                  'foreign_table' =&gt; 'category',
                  'foreign_table_where' =&gt; 'AND category.id=###REC_FIELD_category_id###',
                  'eval'     =&gt; 'int',
                  'checkbox' =&gt; '0',
                  'default' =&gt; 0
              )
          ),
  </code></pre>
  
  <p>it connects the Books and Categories using <code>category_id</code> (in Books-table) and <code>uid</code> (in Category-table).</p>
  
  <p>Not like I would like, that it would connect them using category_id(in Books-table) and id(in Category-table). This id is a id of the category and can be different that uid.</p>
  
  <p>Am I doing something wrong or does Typo3 somehow automatically makes this "connection" to foreign tables <code>uid</code>. ? Is there some way to get it like I would like?</p>