rgb192
asked on
adding latest datetime to existing query
I want to add latest orderitems.dateadded (datetime) to each row of query
select i.productid,COUNT(*) cnt
from orderitems i
left join products p on p.productid=i.productid
group by i.productid
order by cnt
select i.productid,COUNT(*) cnt
from orderitems i
left join products p on p.productid=i.productid
group by i.productid
order by cnt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
select i.productid, MAX(i.dateadded), COUNT(*) cnt
from orderitems i
left join products p on p.productid=i.productid
group by i.productid
order by cnt