Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    7

    Unanswered: distinct: removing dups

    should be a simple resolution but I'm not familiar enough...

    I have the following [simplified] query which generates duplicate rows that I need to get rid of.

    SELECT MY_ID, DESCRIPTION, NAME
    FROM MYTABLE

    When I insert the distinct command, DB2 tells me:
    SQL0134N Improper use of a string column, host variable, constant, or
    function "DESCRIPTION". SQLSTATE=42907

    The datatype of DESCRIPTION is LONG VARCHAR and that cannot change nor the need to query that column. It seems this is preventing distinct from working. It will work without DESCRIPTION being pulled, of course, but again - I need that column.

    How do I use SQL to remove the duplicates I am getting since distinct seemingly cannot be used in this scenario ? Can a "WHERE" clause somehow help ?

    Thanks
    Last edited by rh71; 12-09-04 at 16:48.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Can you use:
    Code:
    SELECT MY_ID, DESCRIPTION, NAME
       FROM MYTABLE
       GROUP BY MY_ID, DESCRIPTION, NAME
    -PatP

  3. #3
    Join Date
    Jul 2004
    Posts
    7
    looks like group by doesn't like DESCRIPTION either... same error.

    SQL0134N Improper use of a string column, host variable, constant, or
    function "DESCRIPTION". SQLSTATE=42907

Posting Permissions

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