-
mysql cùi bấp....
đoạn query vầy mà báo lổi....
Sory với các bác mysql nha... mình quen với sqlserver nên mới qua còn lạ với mysql
delete from 'tablepoint'
where uid=1 and idpoint < ( select max(idpoint) as idpoint from 'tablepoint' where uid=1);
báo lỗi: #1093 - You can't specify target table 'tablepoint' for update in FROM clause
Bên sqlserver còn lâu mí bị.
sửa lại thành:
delete from 'tablepoint'
where uid=1 and idpoint < 1000;
thì chạy ok... hic....
mình cũng bótay.com với nó lun... mọi người giúp mình nhé
-
delete from 'tablepoint'
where uid=1 and idpoint not in (select max(idpoint) from 'tablepoint' where uid=1);
-
thanks bạn... tuy câu bạn hơi khác kết quả một chút nhưng tình trạng chung vẩn vậy:
câu của bạn thế "<" ="not in" nó cũng sẽ báo lỗi: 1064 (syntax).....near ... 'tablepoint'
-
Đọc kỹ document trước khi làm: http://dev.mysql.com/doc/refman/5.0/...ry-errors.html
Code:
delete from 'tablepoint'
where uid=1 and idpoint < (select idpoint from (select max(idpoint) as idpoint from 'tablepoint' where uid=1) as tmptable);
-
Đúng là chưa đọc kỹ cái này rồi. thanks bác nhiều nha...
Vậy mới biết đây là một chổ khác của mysql so với sqlserver. Rắc rối hơn....
hic....