Access parent query values in subquery containing variables
===

I've done quite a bit of looking around on this and would like to exhaust all possibilities before we take a different tack.

The following query:

    SELECT 
        node.nid AS nid
    FROM
        node node
    WHERE
        (node.type in ('new_catalog_master')) 
    AND (SELECT 
            status
        FROM
            (SELECT 
                @COST := (SELECT 
                        pm.field_price_matrix_ppu_value
                    FROM
                        node n
                    INNER JOIN content_type_new_catalog_master ncm ON ncm.nid = n.nid
                    INNER JOIN content_type_vendor_price_object vpo ON vpo.field_vpo_product_ref_nid = ncm.nid
                    INNER JOIN content_type_price_matrix pm ON pm.nid = vpo.nid
                    WHERE
                        ncm.nid = node.nid AND vpo.field_vpo_pref_vendor_value = 'yes' AND pm.field_price_matrix_quantity_value = (SELECT 
                            MAX(field_price_matrix_quantity_value)
                        FROM
                            content_type_price_matrix
                        WHERE
                            nid = vpo.nid)),
                    @DATA_MARGIN := (SELECT 
                        cs.low
                    FROM
                        competitor_stats cs
                    WHERE
                        cs.nid = node.nid),
                    @SUGGESTED_MARGIN := (1-(@COST/@DATA_MARGIN))*100,
                    @MARGIN := (SELECT 
                        field_margin_matrix_gross_margin_value
                    FROM
                        content_type_flexi_margin_matrix
                    WHERE
                        nid = node.nid AND field_margin_matrix_role_value = 1),
                    @MARGIN_MAX := 5/100,
                    (ABS(@SUGGESTED_MARGIN-@MARGIN) > @SUGGESTED_MARGIN*@MARGIN_MAX) AS status
            ) as result);

Returns:

    Unknown column 'node.nid' in 'where clause'

If we hardcode in a nid value into the subqueries, the query returns a value. Is it possible to access node.nid in the subqueries?

We kind of need to keep the subqueries in the WHERE clause due to certain contraints.
