sql - Remove all rows Except condition -


i remove rows table except when firstname ben , isadmin true

here sql

delete table1 (firstname <> 'ben' , isadmin = 1); 

however, issue when isadmin false... should remove row doesn't remove it. issue here?

the correct sql should be

delete table1 (firstname <> 'ben' or isadmin = 0); 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -