>SELECT ; > areakode, stakode, deviceid, relayminor, relaymajor, ; > IIF(EMPTY(relaymajor)," ",stakode)+ ; > IIF(EMPTY(relayminor)," ",stakode) AS cGroup1 ; > FROM premaint!premaint ; > GROUP BY deviceid,cGroup1 ORDER BY deviceid>It turns out that the
IIF(EMPTY(relaymajor)," ",STR(RECNO('premaint'),4))
was always giving me the RECNO() of the last record, resulting in fewer than expected records; that must be something unique to VFP7's implementation of the SQL SELECT syntax.HAVING CNT(*)=1
also gave me too few records; I was really looking for HAVING CNT(*)>0
which is the default behavior. Perhaps I was not clear in my initial request.