删除表中的所有帖子除了big_image有值的那个帖子?

Cla*_*son 2 sql sql-delete

我想删除表中的所有帖子,除了big_image有值的那个帖子?

我几乎尝试了所有东西,但它不起作用!这是最后一个:

sql3="delete from links where userId="& session("user_id") &" 
and big_image NOT IN (select big_image 
from links 
where userId = "& session("user_id") &" and big_image="& bgbild &");"
Run Code Online (Sandbox Code Playgroud)

我真的很感激一些帮助.

Lar*_*tig 5

DELETE FROM Links WHERE UserID = :UserID AND Big_Image IS NULL
Run Code Online (Sandbox Code Playgroud)

请参考您的查询,或者您很快就会发现自己在链接中没有任何记录通过SQL注入.