![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 Pomógł: 0 Dołączył: 4.09.2007 Ostrzeżenie: (0%) ![]() ![]() |
Proszę o pomoc :
Mam 3 tabelki: Tabela: User ( User_id, User_name, User_adress, ....) Tabela: Orders ( User_id, Order_id, ...... ) Tabela: Orders_item ( Order_id, Order_item_name, Product_quantity, ….) SELECT order_item.order_item_name, sum(order_item.Product_quantity), user.User_name, user.User_adress FROM order_item LEFT JOIN orders ON order_item.order_id=orders.order_id LEFT JOIN user ON orders.user_id=user.user_id WHERE order_item.order_item_sku <30 GROUP BY order_item.order_item_name; Proszę pomóżcie bo chcę otrzymać wynik, jestem kiepski w sql-u: ------------------------- Oreder_item_name---------Order_item_name2--------Order_item_name..-------| User_name1, User_adress-Sum of Product_quantity---Sum of Product_quantity--Sum of Product_quantity User_name1, User_adress-Sum of Product_quantity---Sum of Product_quantity--Sum of Product_quantity Ten post edytował kyke 4.09.2007, 15:51:15 |
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 14 Pomógł: 0 Dołączył: 21.06.2007 Ostrzeżenie: (0%) ![]() ![]() |
witam, jest to tylko sugestia, nie wiem co chcesz uzyskać, czy zadziała i w czym jest błąd, proponuję taki styl:
(gdzies tam jeszcze SUM() dopisać trzeeba)
pogrupowane wg Users_id, bo jeśli miało by być wg Order_item_name, to całe zapytanie trzeba przerobić i nie wiązać po User_id, bo to chyba niema sensu ![]() |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 12.06.2025 - 12:26 |