Products contains an ProductID, Product name as well as other descriptors. It can have multiple records for the same ID & Product Name.
Transactions contain a ProductID, category and various fields of information based on the sale of specific products.
I'm trying to query the Transactions and retrieve a count of transactions for a specific category along with the Product Name from the Products table.
The count is multiplying the number of records found in the Transaction table by the number of records in the Products table.
How can I correct this?
Select Distinct count(a.pProductID)
from TRANSACTION_TABLE a
INNER JOIN PRODUCTS B
ON A.PRODUCT_ID = B.PRODUCT_ID
GROUP BY B.PRODUCT_NAME
"It can have multiple records for the same ID & Product Name."
You can't without creating some form of subquery that returns a single record for each Product ID.
Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.