>>lcStr = [select weblog.agent, ]+; >>[sum(iif(weblog.function="GetCars" or "GETCARS"$weblog.xmlstr,1,0)) as RateRequests,]+; >>[sum(iif(weblog.function="CarRes" or "CARRES"$weblog.xmlstr,1,0)) as Bookings ]+; >>[from weblog order by weblog.agent group by weblog.agent] >>=sqlexec( oConnection, lcStr, "TempCursor" ) >>>>TIA
>TEXT TO lcStr NOSHOW > select weblog.agent, > SUM(CASE WHEN weblog.function = 'GetCars' OR > CHARINDEX('GETCARS', weblog.xmlstr) > 0 > THEN 1 > ELSE 0 END) as RateRequests, > SUM(CASE WHEN weblog.function = 'CarRes' OR > CHARINDEX('CarRes', weblog.xmlstr) > 0 > THEN 1 > ELSE 0 END) as Bookings > from weblog > group by weblog.agent --- Group must be before ORDER BY > order by weblog.agent >ENDTEXT >