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 CONCAT(`phone_pref`, '-', `phone_suff`) FROM `pnums` > WHERE `id`=`usertable`.`id`) AS pnum FROM `usertable` WHERE pnum LIKE > '555-12%'; > > It gives me this error: > Error Code : 1054 > Unknown column 'pnum' in 'where clause' > > > Any ideas? > > > Steven Staples > > > Keith J. Clark Business Manager Owner The Bookworm Waterloo Hosting Quality Used Books Complete Web Hosting Provider www.k-wbookworm.com www.waterloohosting.com sa...@k-wbookworm.com sa...@waterloohosting.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org