I have tried to define a more understandable SQL query based on your one.
Can you confirm that I got your intention right?
p.id, p.categoryId, p.product_name
p.categoryId = c.id
This query produces the following error message in SQL Management Studio indicating that you can select only columns added to the group by clause or aggregate functions over these columns:
Msg 8120, Level 16, State 1, Line 1
Column 'product.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
If you are referring to this exception then you can utilize OpenAccess to do the heavy lifting for you by issuing multiple queries that will load all the columns (properties) using a simple LINQ query like that:
var query = from p
context.Categories on p.CategoryID equals c.Id
group p by p.CategoryID;
or in VB.NET:
query = From p
p.CategoryID = c.Id
Group p By p.CategoryID
Please note that this LINQ query will result in multiple SQL queries in order to load the data and work around the limitation in SQL.
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.