Frieden den Palästinensern.
Ich verscuhe mit einem sql query die Anzahl aller Posts, die sich innerhalb
von 4 Themen befinden, zu ermitteln + den timestamp des letzten posts.
Mit diesem query bekomme ich als last_post_time aber NULL zurück...
Und wie bekomme ich auch gleich noch die id des letzten posts zurück?
Tabelle sj_forums
Tabelle sj_posts
Also passende Suchbegriffe für Google fallen mir schonmal nicht ein.
Ich verscuhe mit einem sql query die Anzahl aller Posts, die sich innerhalb
von 4 Themen befinden, zu ermitteln + den timestamp des letzten posts.
Mit diesem query bekomme ich als last_post_time aber NULL zurück...
Code:
SELECT COUNT(*) AS `count_posts`, MAX(time) AS `last_post_time`
FROM `sj_posts` WHERE `sub` IN (1, 2, 3, 4)
Tabelle sj_forums
Code:
CREATE TABLE `sj_forums` (
`id` int(10) unsigned NOT NULL default '0',
`sub` int(11) NOT NULL default '0',
`pos` int(11) NOT NULL default '0',
`liststyle_subforums` tinyint(1) NOT NULL default '1',
`list_topics` tinyint(1) NOT NULL default '1',
`title` text collate latin1_general_ci NOT NULL,
`desc` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
Tabelle sj_posts
Code:
CREATE TABLE `sj_posts` (
`id` int(11) NOT NULL,
`sub` int(11) NOT NULL,
`time` int(11) NOT NULL,
`autor_id` int(11) NOT NULL,
`title` text collate latin1_general_ci NOT NULL,
`text` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
Also passende Suchbegriffe für Google fallen mir schonmal nicht ein.