Seite 1 von 1

Von MySql zu PostgreSQL

Verfasst: 28.10.2005 22:08
von Kêitaro
Hallo @All

Könnte mir vielleicht jmd. diese Sql Anweisung:

Code: Alles auswählen

$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id
			FROM ((( " . FORUMS_TABLE . " f 
			LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
			LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) 
			LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = p.post_id ) 
			ORDER BY f.cat_id, f.forum_order";
in PostgreSql ändern? Hier der falsche Ansatz:

Code: Alles auswählen

	$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id
				FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t
				WHERE p.post_id = f.forum_last_post_id 
					AND u.user_id = p.poster_id  
					UNION (
						SELECT f.*, NULL, NULL, NULL, NULL
						FROM " . FORUMS_TABLE . " f
						WHERE NOT EXISTS (
							SELECT p.post_time
							FROM " . POSTS_TABLE . " p
							WHERE p.post_id = f.forum_last_post_id  
						)
					)
					ORDER BY cat_id, forum_order";
Grüße

Verfasst: 30.10.2005 14:26
von Kêitaro
*push*

BÜDDDDDEEEEE.....

Verfasst: 24.11.2005 14:31
von ExarKun2000
ähm, wieso lässt du sie nicht einfach? die anweisung ist sauber in postgres ausführbar...

cu tb

ps: www.pg-forum.de -> neu, deutsch (!) und ist über postgres...