![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 270 Pomógł: 0 Dołączył: 15.06.2003 Ostrzeżenie: (0%) ![]() ![]() |
Moja struktuta bazy:
[sql:1:fb5ad8cc22] CREATE TABLE `forum_tematy` ( `id` int(5) NOT NULL auto_increment, `autor` varchar(50) NOT NULL default '', `tytul` varchar(100) NOT NULL default '', `tresc` text NOT NULL, KEY `id` (`id`) ) TYPE=MyISAM AUTO_INCREMENT=37 ; CREATE TABLE `forum_wpisy` ( `id` int(5) NOT NULL auto_increment, `forum` int(5) NOT NULL default '0', `temat` int(5) NOT NULL default '0', `autor` varchar(50) NOT NULL default '', `tresc` text NOT NULL, KEY `id` (`id`) ) TYPE=MyISAM AUTO_INCREMENT=147 ; [/sql:1:fb5ad8cc22] chce pobrać jeden wpis z forum_tematy i wszystkie mu odpowiadające wpisy w forum_wpisy. Bazy te są powiacane poprzez forum.tematy.id i forum_wpisy.forum Próbowałem wiele sposobów jednak żaden nie działa do końca poprawnie. [sql:1:fb5ad8cc22] SELECT * FROM forum_tematy LEFT JOIN forum_wpisy on forum_tematy.id = forum_wpisy.temat WHERE forum_tematy.id='10' [/sql:1:fb5ad8cc22] podobnie [sql:1:fb5ad8cc22] SELECT t1.*, t2.* FROM forum_tematy t1, forum_wpisy t2 WHERE t1.id='10' [/sql:1:fb5ad8cc22] Jak powinno wyglądać poprawne zapytanie ![]() |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 18.07.2025 - 01:40 |