Answer the question
In order to leave comments, you need to log in
Which plugin can create a gallery for any content?
What plugin is suitable for organizing a gallery not only for a picture, but for any content?
That is, to work on the principle of the Lightbox gallery in Magnific Popup, but with divs, and not just pictures. We click on the picture (or any block) and a pop-up window appears with the desired content (picture, text - whatever we put in a div) and then you can scroll to the next block.
Answer the question
In order to leave comments, you need to log in
Your query building logic is slightly wrong. First, group the Order_position and Order_other tables by GROUP BY Order_id. And then combine them with the order.
Added code:
SELECT O.ID
,O.Customer
,x.Summ
,y.summ
FROM ORDER O
LEFT JOIN (
SELECT order_id
,SUM(Price * Value) AS summ
FROM Order_other
GROUP BY order_id
) x ON O.Id = x.Order_id
LEFT JOIN (
SELECT order_id
,SUM(Weight) AS summ
FROM Order_position
GROUP BY order_id
) y ON O.Id = y.Order_id
select
t3.id,
t3.Customer,
t3.weight,
t4.others
from
(
select
t1.id,
t1.Customer,
t2.weight
from Order t1
inner join
(
select
Order_id,
sum(Weight) as weight
from Order_position
group by Order_id
) t2 on t2.Order_id = t1.id
) t3
inner join
(
select
Order_id,
sum(Price * Value) as others
from Order_other
group by Order_id
) t4 on t4.Order_id = t3.id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question