Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Zapytanie pobiera kilka razy ten sam rekord ;/
pgrzelka
post
Post #1





Grupa: Zarejestrowani
Postów: 313
Pomógł: 24
Dołączył: 9.08.2008
Skąd: Kielce

Ostrzeżenie: (0%)
-----


  1. SELECT pr.*, t.tytul,pl.placowka, po.produkt
  2. FROM #__aiba_produkty pr
  3. LEFT JOIN #__aiba_tytuly t ON (pr.tid=t.id)
  4. LEFT JOIN #__aiba_powiazania po ON (po.produkt=pr.id)
  5. LEFT JOIN #__aiba_placowki pl ON (po.placowka=pl.id)
  6. WHERE pr.active='1' ORDER BY pr.date DESC LIMIT 10


powyższe zapytanie ma pobrać wszystkie rekordy z tabeli jos_aiba_produkty
niestety niektóre produkty pobiera 2-3 razy i nie wiem czemu ;/
domyślam się że problem jest z tabelą jos_aiba_powiazania ale nie mam pojęcia gdzie tu jest błąd ;/
z góry dziękuje za pomoc (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

struktura tabel
  1. CREATE TABLE IF NOT EXISTS `jos_aiba_placowki` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `pid` int(11) NOT NULL,
  4. `cid` int(11) NOT NULL,
  5. `lid` int(11) NOT NULL,
  6. `uid` int(11) NOT NULL,
  7. `active` tinyint(1) NOT NULL,
  8. `placowka` varchar(255) collate utf8_polish_ci NOT NULL,
  9. PRIMARY KEY (`id`),
  10. KEY `pid` (`pid`,`cid`,`lid`)
  11. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=30 ;
  12.  
  13.  
  14.  
  15. CREATE TABLE IF NOT EXISTS `jos_aiba_powiazania` (
  16. `id` int(11) NOT NULL AUTO_INCREMENT,
  17. `produkt` int(11) NOT NULL,
  18. `placowka` int(11) NOT NULL,
  19. PRIMARY KEY (`id`)
  20. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=38 ;
  21.  
  22.  
  23. CREATE TABLE IF NOT EXISTS `jos_aiba_produkty` (
  24. `id` int(11) NOT NULL AUTO_INCREMENT,
  25. `uid` int(11) NOT NULL,
  26. `tid` int(11) NOT NULL,
  27. `date` int(11) NOT NULL,
  28. `name` varchar(255) collate utf8_polish_ci NOT NULL,
  29. `specjalizacja` tinytext collate utf8_polish_ci NOT NULL,
  30. `ocena` float NOT NULL,
  31. `opinie` int(11) NOT NULL,
  32. `ip` varchar(32) collate utf8_polish_ci NOT NULL,
  33. `active` tinyint(1) NOT NULL,
  34. PRIMARY KEY (`id`)
  35. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=40 ;
  36.  
  37.  
  38. CREATE TABLE IF NOT EXISTS `jos_aiba_tytuly` (
  39. `id` int(11) NOT NULL AUTO_INCREMENT,
  40. `tytul` varchar(128) collate utf8_polish_ci NOT NULL,
  41. PRIMARY KEY (`id`)
  42. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=5 ;
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 00:15