On 22-Jan-2004 Michael McTernan wrote:
> Hi there,
> 
> Thanks for your quick response!
> 
>> Why all the locks, temp tables and updates? You can just do:
>>
>> SELECT
>>   CASE WHEN B.y IS NULL THEN A.x ELSE B.y END AS newX
>> FROM
>>   A LEFT JOIN B ON A.x = B.x
> 
> Spot on - many thanks!  I wasn't aware of the CASE function, but I've
> certainly learnt something now :)
> 

Also look at SELECT COALESCE(B.y, A.x) ...

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to