From: jkraai Date: March 29 1999 3:00am Subject: Re: Sql Query List-Archive: http://lists.mysql.com/mysql/1117 Message-Id: <36FEECE3.370263F4@polytopic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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