I have 2 queries `qry_tbl_crt_bookings_by_container` which prompts the user for a container number and a second query which I want to count some values from the first query:
The query above is the best I could actually make that actually returns the the correct count. However, it prompts the user for a container number two times. Any ideas on how I can fix this? I can make changes to the previous query and actual table if needed.
SQL:
SELECT qry_tbl_crt_bookings_by_container.Container,
(SELECT Count(*) FROM (SELECT DISTINCT PO FROM qry_tbl_crt_bookings_by_container AS SubQ WHERE SubQ.Container = qry_tbl_crt_bookings_by_container.Container)) AS CountOfPO,
(SELECT Count(*) FROM (SELECT DISTINCT [800 Split] FROM qry_tbl_crt_bookings_by_container AS SubQ WHERE SubQ.Container = qry_tbl_crt_bookings_by_container.Container)) AS CountOf800Split,
(SELECT Count(*) FROM (SELECT DISTINCT EAN FROM qry_tbl_crt_bookings_by_container AS SubQ WHERE SubQ.Container = qry_tbl_crt_bookings_by_container.Container)) AS CountOfEAN,
Sum(qry_tbl_crt_bookings_by_container.Pallets) AS SumOfPallets
FROM qry_tbl_crt_bookings_by_container GROUP BY qry_tbl_crt_bookings_by_container.Container;
The query above is the best I could actually make that actually returns the the correct count. However, it prompts the user for a container number two times. Any ideas on how I can fix this? I can make changes to the previous query and actual table if needed.