<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table.]]></title><description><![CDATA[<p>Hallo,<br />
ich möchte das gleiche wie die sql Anfrage &quot;SELECT titel,<br />
SUM(stunden) FROM table GROUP BY titel&quot; aber nur für table, ich benutze ein FlatFile Table-Komponent die kein SQL benutzt und möchte das gleiche Ergebniss wie bei den SQL Anfrage aber über der Table-Component. sowas [vielleicht] wie:</p>
<p>while(!table-&gt;Eof)<br />
{<br />
//.....<br />
}</p>
<p>danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/148668/ähnlich-wie-die-sql-quot-group-by-quot-aber-für-table</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 15:57:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148668.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 May 2006 11:09:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 11:09:35 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich möchte das gleiche wie die sql Anfrage &quot;SELECT titel,<br />
SUM(stunden) FROM table GROUP BY titel&quot; aber nur für table, ich benutze ein FlatFile Table-Komponent die kein SQL benutzt und möchte das gleiche Ergebniss wie bei den SQL Anfrage aber über der Table-Component. sowas [vielleicht] wie:</p>
<p>while(!table-&gt;Eof)<br />
{<br />
//.....<br />
}</p>
<p>danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067261</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067261</guid><dc:creator><![CDATA[C++_Hoby]]></dc:creator><pubDate>Mon, 29 May 2006 11:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 12:30:51 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
ich kenne deine Komponente nicht, abe wenn die kein SQL unterstützt, must du das manuell aus den Datensätzen zusammensetzen.<br />
Also so wie du es schon angefangen hast. Ich gehe mal davon aus das das Table-Objekt sich genauso verhält wie ein normales TTable</p>
<pre><code class="language-cpp">int sum = 0;
while(!table-&gt;Eof)
{
  sum += table-&gt;FieldByName(&quot;stunden&quot;)-&gt;AsInteger;
  table-&gt;Next();
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067324</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 29 May 2006 12:30:51 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 12:44:44 GMT]]></title><description><![CDATA[<p>ja, aber damit summierst du die gesamten Stunden, es soll nur die Stunden summieren die den gleichen Titel haben.<br />
Original Tabelle:</p>
<p>Titel...........Stunden<br />
-----------------------<br />
Titel1............5<br />
Titel1............3<br />
Titel2............2<br />
Titel2............9</p>
<p>die Lösund die ich suche soll mir diesen Ergebnis liefern:</p>
<p>Titel...........Stunden<br />
-----------------------<br />
Titel1.............8<br />
Titel2.............11</p>
<p>und das geht anders, aber wie?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067337</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067337</guid><dc:creator><![CDATA[C++_Hoby]]></dc:creator><pubDate>Mon, 29 May 2006 12:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 13:06:14 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>im Grunde genauso, nur must du eben in der Schleife noch die Bedingung einbauen.<br />
Das heißt du machst dir eine std::map, die deine Daten sammelt.</p>
<pre><code class="language-cpp">#include &lt;map&gt;
...
std::map&lt;AnsiString, int&gt; sums; // Neue leere Map, um nach Titel gruppiert die Summen zu erhalten
std::map&lt;AnsiString, int&gt;::iterator it; // Ergebnis einer Suche in der Map
AnsiString title;

while(!table-&gt;Eof)
{
  title = table-&gt;FieldByName(&quot;titel&quot;)-&gt;AsString;
  it = sums.find(title); // Überprüfen ob bereits für diesen Titel ein Wert vorhanden ist

  // Wenn noch kein Wert für Titel, diesen eintragen
  if (it == sums.end())
    sums.insert(std::map&lt;AnsiString, int&gt;::value_type(title, table-&gt;FieldByName(&quot;stunden&quot;)-&gt;AsInteger);

  // Wenn Wert vorhanden, Wert erhöhen
  else
    it-&gt;second += table-&gt;FieldByName(&quot;stunden&quot;)-&gt;AsInteger;
  table-&gt;Next();
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067371</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 29 May 2006 13:06:14 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 13:18:14 GMT]]></title><description><![CDATA[<p>vielen dank,<br />
ich hab's gleich ausprobiert aber bei</p>
<pre><code>sums.insert(std::map&lt;AnsiString, int&gt;::value_type(title, Table1-&gt;FieldByName(&quot;Minuten&quot;)-&gt;AsInteger);
</code></pre>
<p>sagt der Copiler:<br />
Function call missing.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067384</guid><dc:creator><![CDATA[C++_Hoby]]></dc:creator><pubDate>Mon, 29 May 2006 13:18:14 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 13:21:50 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>abschließende Klammer fehlt</p>
<pre><code class="language-cpp">sums.insert(std::map&lt;AnsiString, int&gt;::value_type(title, Table1-&gt;FieldByName(&quot;Minuten&quot;)-&gt;AsInteger));
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067391</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 29 May 2006 13:21:50 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 13:29:21 GMT]]></title><description><![CDATA[<p>danke noch mal,<br />
aber wie kann ich diesen Ergebnis ansehen, die Tabelle ändert sich nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067408</guid><dc:creator><![CDATA[C++_Hoby]]></dc:creator><pubDate>Mon, 29 May 2006 13:29:21 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 13:39:23 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>nein die Tabelle ändert sich nicht, das kann sie so auch gar nicht. Du must die Daten in einem Extra Control darstellen, zum Beispiel in einer ListBox</p>
<pre><code class="language-cpp">// ... map erstellen, direkt danach komplett in ListView ausgeben
ListBox-&gt;Items-&gt;Clear();
for (it = sums.begin(); it != sums.end(); ++it)
{
  ListBox-&gt;Items-&gt;Add(it-&gt;first + &quot; : &quot; + IntToStr(it-&gt;second));
}
</code></pre>
<p>Diese Unflexibilität ist übrigens der Grund, warum von TTable und äquivalenten abgeraten wird.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067418</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 29 May 2006 13:39:23 GMT</pubDate></item><item><title><![CDATA[Reply to ähnlich wie die sql &amp;quot;group by&amp;quot; aber für Table. on Mon, 29 May 2006 13:49:23 GMT]]></title><description><![CDATA[<p>mensch vielen Dank für dein Antwort.<br />
es klappt supper.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1067430</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1067430</guid><dc:creator><![CDATA[C++_Hoby]]></dc:creator><pubDate>Mon, 29 May 2006 13:49:23 GMT</pubDate></item></channel></rss>