[UPHPU] discovered ISNULL() for default join values in MySQL
Wade Preston Shearer
wadeshearer.lists at me.com
Mon Feb 22 18:37:16 MST 2010
On 22 Feb 2010, at 18:16, Joseph Scott wrote:
> So wouldn't this be the same:
>
> SELECT hans.this, hans.that, COALESCE(frans.the, 'default value') as other
> FROM database_hans hans
> LEFT JOIN database_frans frans
> ON hans.fk=frans.pk
>
>
> Since COALESCE will return the first non-null item in the list given
> to it. If frans.the is not null then it will be used, and if it is
> null then you'll get back 'default value' since that string will never
> be null.
Ah, yes it would. Thanks for the example. That's not how I understood it working from my quick read in the manual. I thought that all the values had to be database columns.
More information about the UPHPU
mailing list