Microsoft
Software
Hardware
Network
Question : SQL Join Group and SUM
Got two tables Category and Product_Table
Category table has the following Fields:
CatID
MainCAT
SubCat
Product_Table has
PN
ClearanceID
The ClearanceID is populated with the CatID from the Category table
What I am trying to do is make a record set that Lists the CategoryID, MainCat and SubCat with a COUNT of how many products in the Product_Table have matching ClearanceID
So the record set would look something like this
CategoryID, MainCat ,SubCat , TheCount
123 Boat Sail 23
124 Boat Motor 4
125 Car Sport 3
126 Car Van 34
But I do not want any records returned where there are no products from the product table
Answer : SQL Join Group and SUM
SELECT
CategoryID,
MainCat,
SubCat,
COUNT(*) TheCount
FROM Category c
INNER JOIN Product_Table p
ON c.CatID = p.ClearanceID
GROUP BY
CategoryID,
MainCat,
SubCat
ORDER BY CategoryID
Random Solutions
When does System.IO.Ports.SerialPort<wbr /> DataReceived event fire?
A custom macro in this report has failed to run, and is preventing the report from rendering.
VFP 9.0 and Installshield
C# -- "Value==null"
Automatically create separate tables from an SQL table defined by field value
How to Receive the windows message DBT_DEVICEQUERYREMOVE
In database mirroring. connection problem to failover partner when original principal is disconnectet
Access DB: "There is no field named" in the table
"Error 1327 Invalid Drive F:/" on Sprint USB Wireless Installation
Upgrade from MSSQL 2005 Express to MSSQL 2008 Standard