** I hate use pseudonims (or whatever they are called) in SELECTs. They make hard to read code. ** I use them only when I don't have a choise i.e. when i want a multiple SELECTs from one table ** I use you code just to make an example. If this code doesn't returns what you want just do as I said in previuos message. ** I just notice that COUNT() function is wrong. You must put the condition in WHERE clause m.nWhatedYear = thisform.text1.Value SELECT DISTINCT dlyatten.date,; dlyatten.code,; dlyatten.category,; (SELECT COUNT(*) FROM (alias11) CatH WHERE dlyatten.date = CatH.date .and. year(CatH.date)=m.nWhatedYear AND CatH.category="H") AS CntCatH,; (SELECT COUNT(*) FROM (alias11) CatB WHERE dlyatten.date = CatB.date .and. year(CatB.date)=m.nWhatedYear AND CatB.category="B") AS CntCatB; FROM dlyatten; INTO CURSOR temp