Results 1 to 5 of 5

Thread: Deleting

  1. #1
    Join Date
    Nov 2006
    Posts
    7

    Unanswered: Deleting

    I'm trying to delete rows that do not contain NULL. This is what i typed in:

    DELETE FROM table WHERE col1 NOT NULL, col2 NOT NULL, date NOT NULL, col3 NOT NULL, col4 NOT NULL, col5 NOT NULL;
    ERROR: parser: parse error at or near "NULL"

    any help would be much appreciated.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    toss the KEYWORD "IS" in there, would you please? and combine your conditions with ANDs, not commas
    Code:
    DELETE 
      FROM daTable 
     WHERE col1 IS NOT NULL
       AND col2 IS NOT NULL
       AND date IS NOT NULL
       AND col3 IS NOT NULL
       AND col4 IS NOT NULL
       AND col5 IS NOT NULL
    just curious, but what good is a table that consists of only rows with NULLs???????
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2006
    Posts
    7
    thanks r937, works great, much appreciated.
    ps
    The rows that contain NULLs do have at least some columns with data in it. I was just experimenting with tables.
    I'm learning SQL and going through tutorials. I knew how to delete rows where only one column was included in the WHERE statement but didn't know how to combine more than one column.

    thanks again .

  4. #4
    Join Date
    Nov 2006
    Posts
    7
    Any one know how to restrict a table so that only a certain amount of rows can be entered?

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by as1sp
    Any one know how to restrict a table so that only a certain amount of rows can be entered?
    see http://www.dbforums.com/showthread.php?t=1612125
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •