This is a discussion on Using an alais in a where statement within the MySQL forums, part of the Database Server Software category; --> select left(number,2) as prefix, name from some_table where prefix = 40 Produces: Error Code : 1054 Unknown column 'prefix' ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| select left(number,2) as prefix, name from some_table where prefix = 40 Produces: Error Code : 1054 Unknown column 'prefix' in 'where clause' So is there another way to accomplish this other than restating the "formula" in the where portion of the statement (some formulas are quite long)? TIA Lee |
| ||||
| On Wed, 21 Mar 2007 13:13:44 GMT, Lee Peedin <lpeedinDONOTSPAME@nc.rr.com> wrote: >select left(number,2) as prefix, name from some_table where prefix = >40 > >Produces: >Error Code : 1054 >Unknown column 'prefix' in 'where clause' > > >So is there another way to accomplish this other than restating the >"formula" in the where portion of the statement (some formulas are >quite long)? > >TIA >Lee Don't you hate it when the answer pops out at you just after you pose the question? :-) select left(number,2)as prefix, name from table_name having prefix = 40 Maybe others can benefit. Lee |