Skip to content
Advertisement

SQL function delete rows with a specific date and a specific value on another column

I have a question, mostly about syntax.

I have a sql table and I need to delete some rows based on the date on a “Date” column as long as they contain a string in a “Client” column

My issue is the syntax since I am not that knowledgeable in query.

    DELETE FROM [dbo].[ClientList]
    WHERE [Date]
   BETWEEN '2019-09-30'  AND '2019-10-01'

is an example, but how do I add besides that condition a condition such as

Where [Client]
LIKE 'CLIENT1' 

it is a simple question but cant find an example of 2 conditions like this.

Advertisement

Answer

You use AND:

DELETE FROM [dbo].[ClientList]
WHERE [Date] BETWEEN '2019-09-30' AND '2019-10-01' AND
      [Client] LIKE 'CLIENT1' 
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement