RE: WHERE clause from AS result

2010-06-11 Thread Steven Staples
Putting the 'HAVING' in there, works perfectly :) THANKS! Steven Staples > -Original Message- > From: SHAWN L.GREEN [mailto:shawn.l.gr...@oracle.com] > Sent: June 10, 2010 8:03 PM > To: Steven Staples > Cc: 'MySql' > Subject: Re: WHERE clause fr

Re: WHERE clause from AS result

2010-06-10 Thread SHAWN L.GREEN
On 6/10/2010 4:38 PM, Steven Staples wrote: Ok, I have done it before, where I have used the AS result in an ORDER BY, but now, I can't figure out why I can't use it in a WHERE clause? SELECT `email`, (SELECT CONCAT(`phone_pref`, '-', `phone_suff`) FROM `pnums` WHERE `id`=`usertable`.`id`) AS pn

Re: WHERE clause from AS result

2010-06-10 Thread Keith Clark
You can use an Alias in ORDER BY but not in WHERE clauses. Keith On Thu, 2010-06-10 at 16:38 -0400, Steven Staples wrote: > Ok, I have done it before, where I have used the AS result in an ORDER BY, > but now, I can't figure out why I can't use it in a WHERE clause? > > SELECT `email`, (SELECT C