user1915108 user1915108 - 1 year ago 99
SQL Question

deleting multiple rows from sql table

I got a sql table, say of the form

name age
h 1
a 2
r 3
i 4


I want to delete the 1st row and 3rd row.
I want something of the form,

delete from tablename where name=h,r;


is this the correct syntax?

Answer Source

Try:

DELETE FROM tablename WHERE name IN ('h', 'r')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download