List:General Discussion« Previous MessageNext Message »
From:Steven Staples Date:June 10 2010 8:38pm
Subject:WHERE clause from AS result
View as plain text  
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


Thread
WHERE clause from AS resultSteven Staples10 Jun
  • Re: WHERE clause from AS resultKeith Clark11 Jun
  • Re: WHERE clause from AS resultSHAWN L.GREEN11 Jun
    • RE: WHERE clause from AS resultSteven Staples11 Jun