Thread forum darstellen: bin am verzweifeln.. (16 answers)
Opened by steinwolf at 2004-01-02 16:43

renee
 2005-01-03 20:31
#32808 #32808
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Also bei mir funktioniert folgendes einwandfrei:

Struktur und Daten (Achtung: topic_id habe ich wegen der Query in thread_id umbenannt):
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# Table structure for table `forum_posts`
#

CREATE TABLE forum_posts (
post_id int(255) unsigned NOT NULL auto_increment,
thread_id int(255) unsigned NOT NULL default '0',
forum_id int(255) unsigned NOT NULL default '0',
poster_id int(255) unsigned NOT NULL default '0',
post_time int(11) NOT NULL default '0',
poster_ip int(8) NOT NULL default '0',
post_edit_time int(11) NOT NULL default '0',
post_edit_count smallint(5) NOT NULL default '0',
post_username varchar(25) NOT NULL default '',
PRIMARY KEY (post_id)
) TYPE=MyISAM;

#
# Dumping data for table `forum_posts`
#

INSERT INTO forum_posts VALUES (2, 0, 1, 1, 0, 0, 0, 0, '');
INSERT INTO forum_posts VALUES (1, 0, 1, 1, 0, 0, 0, 0, '');
INSERT INTO forum_posts VALUES (3, 3, 1, 1, 0, 0, 0, 0, '');
INSERT INTO forum_posts VALUES (4, 3, 1, 1, 0, 0, 0, 0, '');
INSERT INTO forum_posts VALUES (5, 2, 1, 1, 0, 0, 0, 0, '');


SQL-Query:[sql]SELECT thread_id, count( thread_id ) AS 'Anzahl Posts'
FROM forum_posts WHERE forum_id = 1
GROUP BY thread_id
ORDER BY thread_id DESC LIMIT 0, 30[/sql]

Ergebnis:
Code: (dl )
1
2
3
4
5
 
thread_id Anzahl Posts
3 2
2 1
0 2
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread forum darstellen: bin am verzweifeln..