Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SELECT disntinct but only not empty records (2000)

    please correct this query...
    SSQL = "SELECT DISTINCT DESCR_COD_2 FROM STAFF WHERE DESCR_COD_2 IS NOT EMPTY ORDER BY DESCR_COD_2 ASC"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SELECT disntinct but only not empty records (2000)

    Instead of IS NOT EMPTY use IS NOT NULL

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SELECT disntinct but only not empty records (2000)

    HUMMM...
    Possible cause... why the code get a value null (???!!!)
    I use:

    SSQL = "SELECT DISTINCT DESCR_COD_2 FROM STAFF WHERE DESCR_COD_2 IS NOT NULL AND REGIONE = '" & Me.Combo1.Text & "' ORDER BY DESCR_COD_2 ASC"
    Set RSSQLD = CNSQL.Execute(SSQL)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SELECT disntinct but only not empty records (2000)

    In your screenshot, the value is an empty string "". This is not the same as null - null means no value at all. Try this:
    <code>
    ... WHERE DESCR_COD_2 IS NOT NULL AND NOT DESCR_COD_2 = '' AND REGIONE ...
    </code>
    The <code>''</code> are two single quotes, not one double quote <code>"</code> !

Posting Permissions

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