SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s). sql query
<p>I have two table that named as 'data' and 'regions'. I want to get regions with data related records as item of regions records.</p>

<p>regions</p>

<pre><code>RegionId -- Name -- ParentId
</code></pre>

<p>data</p>

<pre><code>DataId -- RegiondId -- Url
</code></pre>

<p>Sample result:</p>

<pre><code>[
{Name:"a", items:[{...},{...},{...}, ...]},
{Name:"b", items:[{...},{...},{...}, ...]},
]
</code></pre>

<p>I used this query </p>

<pre><code>SELECT *,(
    SELECT * 
    FROM data 
    WHERE data.RegionId=regions.RegionId
) AS items 
FROM regions 
WHERE regions.ParentId=1
</code></pre>

<p>But I got <code>SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)</code>.</p>

<p>Important: Region has parent relation between its records. So I when write this condition <code>data.RegionId=regions.Id</code> it must return that items has matches <code>RegionIds</code> of it's childs.</p>