Hi,
> create function usage(text)
> returns numeric
> as 'select ceil(sum(sessiontime)/60) from ath_online
> where loginname=\'$1\' and startdate >= (select
> startdate from cst_package where status=\'t\' and
> cid=(select cid from cst_customer where
> loginname=\'$1\'));'
> language 'sql';
Try to replace \'$1\' with just $1 (i.e. loginname = $1).
Regards
--
Matteo Beccati
C.R.P. Software S.r.l.
http://www.crpsoftware.it/