Delete?

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

Hi,

I have a table like this:

ColA ColB
22 Drink
22 Eat
22 Spill
23 Drink
23 Eat
24 Drink
24 Spill


I want to delete all records for a number where ColB = Spill. For
example, since 22 has a Spill Entry and 24 has a spill entry, it would
delete all rows where ColA has 22 and where ColA has 24. I'm guessnig a
SQL query would do this?

Any help is very appreciated!! Thanks!
 
Hi Dan,

Do you mean

DELETE * FROM myTable outerLoop
WHERE EXISTS
(
SELECT * FROM myTable innerLoop
WHERE innerLoop.ColB = "Spill"
AND innerLoop.ColA = outerLoop.ColA
)

?

Cheers,

Chris.
 
DELETE FROM TheTable WHERE ColB='Spill'

Pieter

dan said:
Hi,

I have a table like this:

ColA ColB
22 Drink
22 Eat
22 Spill
23 Drink
23 Eat
24 Drink
24 Spill


I want to delete all records for a number where ColB = Spill. For
example, since 22 has a Spill Entry and 24 has a spill entry, it would
delete all rows where ColA has 22 and where ColA has 24. I'm guessnig a
SQL query would do this?

Any help is very appreciated!! Thanks!



--
 
No!
I very nearly posted that, then I read his question more carefully...

Cheers,

Chris.

"Pieter Wijnen"
 
Errare humanum est

Pieter

ChrisM said:
No!
I very nearly posted that, then I read his question more carefully...

Cheers,

Chris.

"Pieter Wijnen"



--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top