?
Solved

Delete multiple items

Posted on 2012-09-18
2
Medium Priority
?
434 Views
Last Modified: 2012-09-18
Hi Experts

I am Very, very new to SQL and need a bit of help.  I need to create a delete statement that
can handle multiple items in the wholesaleID.  Here is the statement that I use
when I am deleting 1 condition at a time.  Very time consuming.  

DELETE
FROM [NYP-RetailDataSQL].dbo.[Sales-Compare918A]
WHERE WholesaleID = '99-MW' AND [Data Date] = '2012-09-11'

I would like to also delete 12-MW, 14-MA, 22-SW, 30-MA, 88-SW which are wholesaleID's.  
Is there a way to incorporate these items into the single item statement so that I am not having to go back change it one at a time?

Much thanks

spudmcc
0
Comment
Question by:spudmcc
2 Comments
 
LVL 9

Accepted Solution

by:
borki earned 2000 total points
ID: 38411911
This might work:

DELETE
FROM [NYP-RetailDataSQL].dbo.[Sales-Compare918A]
WHERE (WholesaleID IN ('99-MW', '12-MW', '14-MA', '22-SW', '30-MA', '88-SW') )
   AND [Data Date] = '2012-09-11'
0
 

Author Closing Comment

by:spudmcc
ID: 38411965
Perfect.  Thanks so much for the quick response and your time.  

A
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question