-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On September 10, 2002 22:32, Paul DuBois wrote: ... > You can't refer to aliases in WHERE clauses. Aliases refer to columns > that have been selected, WHERE clauses determine which columns should > be selected. In essence, WHERE refers to "input" columns, which occurs > earlier than the aliases (which refer to "output" columns).
Hi Nicholas, You may be able to get the effect that you desire using user variables. (see http://www.mysql.com/doc/en/Variables.html for details) The following query using user variables *might* work for you :) SELECT i.id image_id, @photo_id := ifnull(i.photographer,"6") photo_id, @owner_id := ifnull(i.owner,"6") owner_id, concat(cp1.fname,' ',cp1.lname) photo_id, concat(cp2.fname,' ',cp2.lname) owner_name, FROM image i, common.persons cp1, common.persons cp2 WHERE i.id='8200' AND @photo_id=cp1.id AND @owner_id=cp2.id; Cheers! - -- Zak Greant <[EMAIL PROTECTED]> MySQL Community Advocate Feed the Dolphin! Order MySQL support from the MySQL developers at https://order.mysql.com/?ref=mzgr "Gosh, Batman! The nobility of the almost-human porpoise." --Robin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9ftPQb6QONwsK8bIRAiFKAJ9xRnNM+Nn0JiFj8AV0GEch0YKVDQCdE8uv kRA6OKVYj8AU9WrPnq/BuI8= =HI5o -----END PGP SIGNATURE----- --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php