List:General Discussion« Previous MessageNext Message »
From:jkraai Date:March 29 1999 3:00am
Subject:Re: Sql Query
View as plain text  
Mike Machado wrote:
> 
> I am trying to run the following query against my database:
> 
> select username,sum(acctsessiontime) as s from radacct where
> acctstarttime > 19990326111500 and acctstoptime < 19990326131500 and
> acctstoptime != 0 and s != 0 group by username order by s desc;
> 
> It tells me Unknown column 's' in 'where clause'
> 
> Am I doing the query wrong? I used s as an ORDER BY but it won't let me
> use it in a WHERE clause? I thought 'as s' lets me use s as if it were a
> 
> column. It workes just fine if I leave off the 'and s != 0' part (but
> then I get rows I didn't really want).
> 
> --
> Mike Machado
> mike@stripped
> InnerCite
> Network Specialist

leave off the 'and s != 0' part, but add 
'having s != 0'

--jim
Thread
Sql QueryMike Machado28 Mar
  • Re: Sql Queryjkraai29 Mar