I need help with a nested query and I can’t quite wrap my head around the correct syntax for what I am trying to do.
Essentially I am just trying to get the percentage of a certain tag (Item_Num) - I want to know the percentage of how many items in a certain transaction are of a particular product.
So if my particular item query was -
select count("Item") from "Transactions" where "Shopper" = $shopper AND "item_Num" = 'x16214' Group By "Transaction"
I would like to nest it in this query -
SELECT
$query / count("Items"), <---- Here
sum("Amount")/sum("Items"),
sum("Navigation")
FROM
"Transactions"
WHERE
"Shopper" = $shopper
GROUP BY
"Transaction"
or like
SELECT
(select count("Item") from "Transactions" where "Shopper" = $shopper AND "item_Num" = ''x16214' Group By "Transaction") / count("Items"),
sum("Amount")/sum("Items"),
sum("Navigation")
FROM
"Transactions"
WHERE
"Shopper" = $shopper
GROUP BY
"Transaction"
Any help would be greatly appreciated
thank you