Answer:
with categorizedorders as
(select o.customerid,
p.category,
o.orderid,
o.orderdate,
row_number() over (partition by o.customerid,
p.category
order by o.orderdate) as orderrank
from orders o
join orderdetails od on o.orderid = od.orderid
join products p on od.productid = p.productid)
select customerid,
category,
orderid,
orderdate
from categorizedorders
where orderrank = 1;