Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Dublowanie i wiecej wyników
szok
post
Post #1





Grupa: Zarejestrowani
Postów: 165
Pomógł: 20
Dołączył: 2.03.2006

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


Witam, mam mały problem, po wykonaniu tego zapytania SQL, niektóre wyniki mam po 4 razy to samo (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) a wpisy w bazie są poprawne, co robię nie tak w tym zapytaniu SQL? Proszę o pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

  1. SELECT
  2. shop_users.id,
  3. shop_orders.id,
  4. shop_orders.klient,
  5. shop_orders.czas,
  6. shop_orders.produkty,
  7. shop_orders.cena,
  8. shop_orders.wysylka,
  9. shop_orders.platnosc,
  10. shop_orders.drukowane,
  11. shop_orders.STATUS,
  12. shop_orders.paragon,
  13. shop_users.imie,
  14. shop_users.nazwisko,
  15. shop_users.ulica,
  16. shop_users.nr_domu,
  17. shop_users.nr_mieszkania,
  18. shop_users.kod_pocztowy,
  19. shop_users.miasto,
  20. shop_users.telefon,
  21. shop_users.email,
  22. shop_orders_useraddress.order_id,
  23. shop_orders_useraddress.useraddress,
  24. shop_orders_date.order_id,
  25. shop_orders_date.prod,
  26. shop_orders_date.reel,
  27. shop_orders_comments.order_id,
  28. shop_orders_comments.comments,
  29. shop_orders_invoices.order_id,
  30. shop_orders_invoices.invoice,
  31. shop_orders_payment.order_id,
  32. shop_orders_payment.pay_status
  33. FROM shop_orders LEFT JOIN shop_users ON (shop_orders.klient=shop_users.id)
  34. LEFT JOIN shop_orders_useraddress ON (shop_orders_useraddress.order_id=shop_orders.id)
  35. LEFT JOIN shop_orders_date ON (shop_orders_date.order_id=shop_orders.id)
  36. LEFT JOIN shop_orders_comments ON (shop_orders_comments.order_id=shop_orders.id)
  37. LEFT JOIN shop_orders_invoices ON (shop_orders_invoices.order_id=shop_orders.id)
  38. LEFT JOIN shop_orders_payment ON (shop_orders_payment.order_id=shop_orders.id)
  39. WHERE shop_orders.STATUS = '3' ORDER BY shop_orders.czas
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Cytat
dodałem DISTINCT za selectem, i rozwiązało problem, ale czy to było dobre rozwiązanie?
No napisalem ci przeciez: wszystko zalezy od tego co chciales osiągnąc. jesli distict daje ci to co chciales to tak, to bylo dobre rozwiązanie.
Nie rozumiem tylko poco wiec dawales przykladowo left joina na komentarze, skoro i tak dales distinct i nie wyciągasz wszystkich komentarzy (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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: 15.10.2025 - 13:58