-2

I wondered if I can get a query like this to work:

"DELETE FROM table WHERE id (BETWEEN 1 AND 5) OR = 8;"

The thing I want to achieve: I want to say; get me the results between some values or also the value if my id = 8.

Unfortunately I only found queries and questions how to search for things like this.

"DELETE FROM table WHERE id BETWEEN 1 AND 5 AND `email`='sarah@sarah.com';"

Or would I have to do it likewise:

"DELETE FROM table WHERE id BETWEEN 1 AND 5 OR id = 8;"

Thanks for a short input on that...

Cheers

Adrian Cid Almaguer
  • 7,815
  • 13
  • 41
  • 63
Merc
  • 4,241
  • 8
  • 52
  • 81
  • I have to agree with Mark it's only need me 10sec to google this [link]http://www.w3schools.com/sql/sql_between.asp – Aleksandar Miladinovic Mar 22 '15 at 00:24
  • well I mean I understood what BETWEEN does. And I personally don't like w3schools answers that's why i banned it from my google results. but yes I may should have tried. – Merc Mar 22 '15 at 01:17

1 Answers1

1

To DELETE:

DELETE FROM table WHERE (id BETWEEN 1 AND 5) OR id = 8

To SELECT:

SELECT * FROM table WHERE (id BETWEEN 1 AND 5) OR id = 8
Adrian Cid Almaguer
  • 7,815
  • 13
  • 41
  • 63