Oh yeah, I overlooked that part. The join makes it multi-table syntax, so you
can't do order by/limit. A quick workaround is to do a subselect:
DELETE
FROM ' . DB_CMS . '.executives_revisions exre
WHERE exre_id IN
(SELECT exre.exre_id
FROM ' . DB_CMS . '.executives_revisions exre
INNER JOIN ' . DB_CMS . '.executives exec
ON exre.exre_exec_id=exec.exec_id
WHERE exre.exre_exec_id=' . $exec_id . '
AND exre.exre_id!=exec.exec_revision
ORDER BY exre.exre_created DESC
LIMIT 5,9999999999999');
I'm assuming exre's primary key is exre_id, if not adjust that query
appropriately.
Jon
On Feb 28, 2011, at 9:58 AM, Wade Preston Shearer wrote:
> On 28 Feb 2011, at 9:57, Jon Jensen wrote:
>
>> In mysql you can, though your syntax is wrong....
>>
>> Try changing "DELETE exre.*" to just "DELETE". Otherwise it thinks you are
>> doing multiple-table syntax, which doesn't allow order by/limit.
>>
>> See http://dev.mysql.com/doc/refman/5.1/en/delete.html
>
> I tried that and it still fails:
>
> …near 'INNER JOIN…"
>
> _______________________________________________
>
> UPHPU mailing list
> [email protected]
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net