![]() |
![]() |
|
![]() |
![]() |
|
Programmierung Rat & Tat für Programmierer |
![]() |
|
Themen-Optionen | Ansicht |
|
![]() |
#1 |
Jr. Member
![]() |
![]() Probier mal...
Code:
UPDATE Zieltabelle SET first_post_id = SELECT MIN(QuellTabelle.post_id) FROM QuellTabelle WHERE QuellTabelle.thread_id = ZielTabelle.thread_id UPDATE Zieltabelle SET last_post_id = SELECT MAX(QuellTabelle.post_id) FROM QuellTabelle WHERE QuellTabelle.thread_id = ZielTabelle.thread_id
____________________________________
lg Yoghurt -- Rettet unsere Wälder, esst mehr Biber! |
![]() |
![]() |
![]() |
#2 |
Veteran
![]() |
![]() Danke !
ich hab einen syntaxfehler drinn und find ihn nicht... Fehler SQL-Befehl: ![]() UPDATE "phpbb_topics" SET "phpbb_topics". "topic_first_post_id" = SELECT MIN( "phpkit_forumpost". "forumpost_id" ) FROM "phpkit_forumpost" WHERE "phpkit_forumpost". "forumthread_id" = "phpbb_topic". "thread_id" MySQL meldet: ![]() #1064 - Fehler in der SQL-Syntax. Bitte die korrekte Syntax im Handbuch nachschlagen (diese kann für verschiedene Server-Versionen unterschiedlich sein) bei '"phpbb_topics" SET "phpbb_topics"."topic_first_post_id" = SELECT MIN'in Zeile 1 _____________________________ Habs auch so probiert: UPDATE "phpkit_forumpost","phpbb_topics" SET "phpbb_topics"."topic_first_post_id" = SELECT "phpkit_forumpost"."forumpost_id" MIN("phpkit_forumpost"."forumpost_id") FROM "phpkit_forumpost" WHERE "phpkit_forumpost"."forumthread_id"="phpbb_topic". "thread_id" Und So: UPDATE "phpkit_forumpost","phpbb_topics" SET "phpbb_topics"."topic_first_post_id" = SELECT "phpkit_forumpost"."forumpost_id", MIN("phpkit_forumpost"."forumpost_id") FROM "phpkit_forumpost" WHERE "phpkit_forumpost"."forumthread_id"="phpbb_topic". "thread_id" __________________________________
____________________________________
Internet is voll, GEH WEG ! ...a friend in need's a friend indeed, a friend with weed is better... be a warrior Geändert von incubus (19.03.2009 um 11:40 Uhr). |
![]() |
![]() |
![]() |
#3 |
Jr. Member
![]() |
![]() Falls du auf einer mySQL Datenbank arbeitest musst du glaub ich das SELECT in extra Klammern setzen. Also so...
Code:
UPDATE "phpbb_topics" SET "phpbb_topics". "topic_first_post_id" = (SELECT MIN( "phpkit_forumpost". "forumpost_id" ) FROM "phpkit_forumpost" WHERE "phpkit_forumpost". "forumthread_id" = "phpbb_topic". "thread_id")
____________________________________
lg Yoghurt -- Rettet unsere Wälder, esst mehr Biber! |
![]() |
![]() |
![]() |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|