SUM in subquery not correct

I have a problem with getting the result I need:

This is the query close to what I need: but I get a count of stock that is like a total of a lot of… I am not sure what? (see screenshot 76 for result)

SELECT 0_item_codes.stock_id
,    0_item_codes.description
,   loc_10
,  loc_20

FROM 0_item_codes
,
 (   SELECT SUM(0_stock_moves.qty) AS loc_10
 
FROM `0_item_codes` 
  JOIN 
	0_loc_stock 
     ON 0_item_codes.stock_id = 0_loc_stock.stock_id
 JOIN 	0_stock_moves
    ON 0_item_codes.stock_id = 0_stock_moves.stock_id

WHERE 
   	 0_item_codes.inactive = 0
    AND 0_stock_moves.loc_code = 10
)
AS loc_10
,

(   SELECT SUM(0_stock_moves.qty) AS loc_20
 
FROM `0_item_codes`
  JOIN 
	0_loc_stock 
    ON 0_item_codes.stock_id = 0_loc_stock.stock_id
 JOIN 	0_stock_moves
    ON 0_item_codes.stock_id = 0_stock_moves.stock_id

WHERE 
   	 0_item_codes.inactive = 0
    AND 0_stock_moves.loc_code = 20
)
AS loc_20

WHERE 0_item_codes.category_id = 16
GROUP BY 
    0_item_codes.stock_id

If I run only one of the subqueries by its self I get the right count of stock (see screenshot 77)


```mysql

SELECT 0_item_codes.stock_id
,    0_item_codes.description
,	SUM(0_stock_moves.qty) AS loc_10
 
FROM `0_item_codes` 
  JOIN 
	0_loc_stock 
     ON 0_item_codes.stock_id = 0_loc_stock.stock_id
 JOIN 	0_stock_moves
    ON 0_item_codes.stock_id = 0_stock_moves.stock_id

WHERE 
   	 0_item_codes.inactive = 0
    AND 0_stock_moves.loc_code = 10
AND  0_item_codes.category_id = 16
GROUP BY 
    0_item_codes.stock_id



How is it that I can get this first statement (above) to give the correct count?

Thanks for all your help... :)
SELECT 0_item_codes.stock_id
     , 0_item_codes.description
     , SUM(CASE WHEN 0_stock_moves.loc_code = 10
                THEN 0_stock_moves.qty
                ELSE NULL END) AS loc_10 
     , SUM(CASE WHEN 0_stock_moves.loc_code = 20
                THEN 0_stock_moves.qty
                ELSE NULL END) AS loc_20 
  FROM 0_item_codes
INNER
  JOIN 0_loc_stock 
    ON 0_loc_stock.stock_id = 0_item_codes.stock_id 
INNER
  JOIN 0_stock_moves
    ON 0_stock_moves.stock_id = 0_item_codes.stock_id
 WHERE 0_item_codes.inactive = 0 
   AND 0_item_codes.category_id = 16
GROUP 
    BY 0_item_codes.stock_id