Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Delete?

Discussion in 'Information Technology' started by dan, Jul 28, 2006.

Tags:
  1. dan

    dan
    Expand Collapse
    Guest

    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!
     
  2. Loading...


  3. ChrisM

    ChrisM
    Expand Collapse
    Guest

    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.

    "dan" <itzdan262@gmail.com> wrote in message
    news:1152881772.236675.314030@m79g2000cwm.googlegroups.com...
    > 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!
    >
     
  4. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    DELETE FROM TheTable WHERE ColB='Spill'

    Pieter

    "dan" <itzdan262@gmail.com> wrote in message
    news:1152881772.236675.314030@m79g2000cwm.googlegroups.com...
    > 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!
    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4231 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     
  5. ChrisM

    ChrisM
    Expand Collapse
    Guest

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

    Cheers,

    Chris.

    "Pieter Wijnen"
    <it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.replace.with.norway>
    wrote in message news:uF3Azh0pGHA.2400@TK2MSFTNGP03.phx.gbl...
    > DELETE FROM TheTable WHERE ColB='Spill'
    >
    > Pieter
    >
    > "dan" <itzdan262@gmail.com> wrote in message
    > news:1152881772.236675.314030@m79g2000cwm.googlegroups.com...
    >> 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!
    >>

    >
    >
    >
    > --
    > ----------------------------------------
    > I am using the free version of SPAMfighter for private users.
    > It has removed 4231 spam emails to date.
    > Paying users do not have this message in their emails.
    > Get the free SPAMfighter here: http://www.spamfighter.com/len
    >
    >
     
  6. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    Errare humanum est

    Pieter

    "ChrisM" <chris_mayersblue@suedeyahoo.com> wrote in message
    news:2-ednVO2NK4mBirZnZ2dnUVZ8qednZ2d@bt.com...
    > No!
    > I very nearly posted that, then I read his question more carefully...
    >
    > Cheers,
    >
    > Chris.
    >
    > "Pieter Wijnen"
    > <it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.replace.with.norway>
    > wrote in message news:uF3Azh0pGHA.2400@TK2MSFTNGP03.phx.gbl...
    >> DELETE FROM TheTable WHERE ColB='Spill'
    >>
    >> Pieter
    >>
    >> "dan" <itzdan262@gmail.com> wrote in message
    >> news:1152881772.236675.314030@m79g2000cwm.googlegroups.com...
    >>> 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!
    >>>

    >>
    >>
    >>
    >> --
    >> ----------------------------------------
    >> I am using the free version of SPAMfighter for private users.
    >> It has removed 4231 spam emails to date.
    >> Paying users do not have this message in their emails.
    >> Get the free SPAMfighter here: http://www.spamfighter.com/len
    >>
    >>

    >
    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4231 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     

Share This Page