Hi Aurélien,

2014-05-19 22:57 GMT+02:00 Aurélien Manteaux <[email protected]>:

> Thanks for you reply !
>
> jOOQ actually let me write this :
>
>> DSLContext deleteQuery = DSL.using(configuration());
>> deleteQuery
>> .delete(
>> TABLE_A
>> .leftOuterJoin(TABLE_B)
>> .on(TABLE_A.ID.eq(TABLE_B.A_ID))
>
> )
>> .where(TABLE_B.A_ID.isNull())
>> .execute();
>
>
> However MySQL does not validate the resulted SQL :
>
>> DELETE /* missing alias */ FROM table_a
>> LEFT JOIN table_b
>> ON table_a.id = table_b.a_id
>> WHERE table_b.a_id IS NULL;
>
>
Curious, that might be a bug. Yes, MySQL and MariaDB have a very peculiar
DELETE syntax, where you should really write something along the lines of
DELETE t1 FROM table_a t1 LEFT JOIN ...

Have you tried aliasing TABLE_A to something? Would that work? It would
still be a bug, though. I have updated #3266 accordingly
https://github.com/jOOQ/jOOQ/issues/3266


> In my case, the TABLE_A.in() statement will be fast enough since the JOIN
> subquery will return just a few rows.
>

Alright.

Cheers
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to