The ''having marked=-1' clause filters out records after the entire query is
completed.  The where clause modifies which recorded get included in the
first place.


> for now it's rather ugly and inefficient, but one way you could do it
would
> be like this:
>
> select table1.*, ifnull(table2.column2,-1) as marked from table1 left join
> table2 on table1.column1=table2.column2 having marked=-1

First when I read this I thought that you probably wanted 'where marked=-1'
rather than 'having marked=-1' but yo are right <?>
I tried it with 'where marked=-1' and I got an error that it didn't know
which one column 'marked' is. Strange...




---------------------------------------------------------------------
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

Reply via email to