How to perform a multiplication by a different select query Hope my question is accepted here and I haven't made a mess out of renaming the tables and columns so you can understand what I need! :)

Query A:

DECLARE @var VARCHAR(7)
SET @var = 'xtpo'
SELECT 
    row_number() over(order by dbo.tbl_A.field_1) AS '1st column', 
    dbo.tbl_A.field_2 AS '2nd column',
    dbo.tbl_B.field_1 AS '3rd column', 
    dbo.tbl_A.field_3 AS '4th column', 
    COUNT(temp0.reference) AS 'Qty'
FROM dbo.tbl_C tbl_c
JOIN dbo.tbl_D tbl_d ON tbl_d.field_4 = tbc_c.field_4
JOIN dbo.tbl_A tbl_a ON tbl_a.field_3 = tbl_d.field_3
JOIN dbo.tbl_B tbl_b ON tbl_a.field_4 = tbl_b.field_4
JOIN (SELECT 
         tbl_e.field_1 f1, 
         tbl_e.field_2,
         tbl_e.field_3 AS f3
      FROM dbo.tbl_E tbl_e
      GROUP BY 
         tbl_e.field_1, 
         tbl_e.field_2,
         tbl_e.field_3, 
         tbl_e.field_1) temp0 ON dbo.tbl_A.field_2 = temp0.f3 AND temp0.f1 = tbl_c.field_2 
WHERE tbl_c.field_1 LIKE @var
GROUP BY dbo.tbl_A.field_a, dbo.tbl_A.field_2. dbo.tbl_B.field_2


Query A is a listing containing 5 columns.

Query B:

DECLARE @var VARCHAR(7)
SET @var = 'xtpo'
SELECT COUNT(DISTINCT PcbID) FROM dbo.tbl_C WHERE dbo.tbl_C.field_5 LIKE @var


How can I integrate Query B on Query A so the 6th column of the listing is a multiplication of Query A's 5th column and the single result of Query B?

Thanks in advance,

gtludwig
Probably simplest would be:

DECLARE @var VARCHAR(7), @c INT;

SET @var = 'xtpo';

SELECT @c = COUNT(DISTINCT PcbID) FROM dbo.tbl_C WHERE dbo.tbl_C.field_5 LIKE @var;

SELECT 
    row_number() over(order by dbo.tbl_A.field_1) AS [1st column], 
    dbo.tbl_A.field_2 AS [2nd column],
    dbo.tbl_B.field_1 AS [3rd column], 
    dbo.tbl_A.field_3 AS [4th column], 
    COUNT(temp0.reference) AS Qty,
    COUNT(temp0.reference) * @c AS [6th column]
FROM dbo.tbl_C tbl_c
...


Note that I changed your 'single quote' aliases to use [square brackets] instead. Single quote aliases are deprecated in some forms, and they are not well-received because they make your aliases look like string literals. In most cases you are better off not using delimiters at all if you don't need them (which means not using column names that require delimiters in the first place).