Results 1 to 5 of 5

Thread: Problems with a DISTINCT

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    4

    Unhappy

    Hi everyone,
    I have a SQL query that uses a DISTINCT to retrieve only unique records. When I run it on iSQL_w (for SQL Server 6.5), it works fine. When I run it within my VB app, the DISTINCT doesn't seem to work (it gives me multiple records instead of uniques).
    Does anyone have an idea about how to correct this ?

    Thanks,
    Joel

  2. #2
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    Not sure if this helps but...


    select distinct testpoint from mytable

    will return all distinct testpoints, for example

    0010
    0020
    0030

    but............

    select distinct testpoint, tpstatus from mytable


    If you choose two fields it must match both...

    for example, testpoint and status

    0010 scheduled
    0010 flown

    not distinct from the testpoint point of view but it is from the testpoint and status.

    Does that help out at all?

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    4

    Unhappy

    Unfortunately, it doesn't apply here. I only have 1 column...
    Thanks anyways

    Joel

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    What is the actual SQL you are using, and how are you applying it?

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  5. #5
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    The other thing is using a client side or server side cursor. Client side updateable cursors do not support DISTINCT.

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

Posting Permissions

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



Click Here to Expand Forum to Full Width