Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Counter and returner, doubles the result
    primarykey
    data
    text
    <p>I'm trying to make a list, showing all of my Categories on my Forum. Showing the Category name, with an ID, aswell as a count, counting how many Threads is attached to this Category.</p> <p>It works perfectly, however, it prints the results twice.</p> <p>This is the SQL</p> <pre><code>SELECT categories.category_name, threads.thread_category_id, COUNT(*) AS 'threadCount' FROM threads INNER JOIN categories ON categories.category_id = threads.thread_category_id GROUP BY categories.category_name, threads.thread_category_id </code></pre> <p>Here is the result <img src="https://i.stack.imgur.com/P6Bm6.png" alt="enter image description here"></p> <p>And as you can see, it prints the same thing twice, which it should't.</p> <p>EDIT: Here is the ASP.</p> <pre><code>&lt;asp:Repeater ID="categories" runat="server"&gt; &lt;HeaderTemplate&gt; &lt;table id="kategorier" cellspacing="0"&gt; &lt;tr&gt; &lt;td class="head"&gt;Name&lt;/td&gt; &lt;td class="head" style="width:70px"&gt;Number of Threads&lt;/td&gt; &lt;/tr&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;tr&gt; &lt;td class="item"&gt;&lt;a href="Kategori.aspx?id=&lt;%# Eval("thread_category_id") %&gt;"&gt;&lt;%# Eval("category_name") %&gt; - ID: &lt;%# Eval("thread_category_id")%&gt;&lt;/a&gt;&lt;/td&gt; &lt;td class="item" style="text-align:right"&gt;&lt;%# Eval("threadCount") %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/table&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; </code></pre>
    singulars
    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.
 

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