gunnar wrote:
> The subquery will always return one result or no result. So I only
> have to UNION it ALL with the SELECT NULL part.

>>> Clemens Ladisch <clemens at ladisch.de> wrote:
>>>> ... WHERE cb_seq_num > (
>>>>        SELECT cb_seq_num
>>>>        FROM ordercallback
>>>>        WHERE cb_uuid=@CBUUID
>>>>        UNION ALL
>>>>        SELECT NULL   -- at least one result
>>>>        LIMIT 1)      -- at most one result

But with the SELECT NULL, the subquery now returns one or two results.
If you do use the UNION ALL, you also need the LIMIT.


Regards,
Clemens

Reply via email to