[thelist] mysql query - replacing characters

r937 rudy at r937.com
Tue Aug 4 12:06:20 CDT 2009

dear eccentric one

i dislike HAVING without a GROUP BY clause -- it often works, but it's 
semantically on shaky ground

but, as i'm sure your tests have revealed, you cannot use a column alias in 
the WHERE clause

there is a solution -- push the alias down into a subquery

    FROM ( SELECT unique_id
                , insanely_complex_expression AS address
             FROM listings
         ) AS d
   WHERE address LIKE '%123EasyStreet%'

this is also one of those rare instances where it is perfectly okay to use 
the dreaded, evil "select star"



More information about the thelist mailing list