>> Date: Thu, 30 Oct 2003 12:45:17 +0100
>> From: Bart Duchesne <[EMAIL PROTECTED]>
>>
>> update mail set size = (select m1.size from mail m1 where m1.id = id and 
>> m1.sender is not null) where sender is null;

Your statement doesn't work for at least 2 reasons.

(1) (m1.id = id) is always true because m1.id and id refer
    to the same column

(2) You meant for id to refer to mail.id in the main query,
    but you can't do that in SQLite.  See
    http://www.sqlite.org/omitted.html (Variable subqueries)

Your statement has a third problem, which I think points out
a BUG in SQLite.  The problem is that your subquery may
return more than one row.  When a subquery is used in a
comparison, it should return a scalar, i.e., one column and
one row.  Unless the standard has changed, returning more
than one row should cause a run-time error, but SQLite
silently uses the first row of the result.

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to