GROUP By clause or DISTINCT clause

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacek

    GROUP By clause or DISTINCT clause

    Hi, can anyone shed some light on this issue?

    SELECT Status from lupStatus
    with a normal query it returns the correct recordcount

    SELECT Status from lupStatus GROUP BY Status
    but with a GROUP By clause or DISTINCT clause it return the recordcount
    = -1

  • Madhivanan

    #2
    Re: GROUP By clause or DISTINCT clause


    Which application are you using? If it is VB then it shold be client
    side cursor

    Madhivanan

    Comment

    • Jacek

      #3
      Re: GROUP By clause or DISTINCT clause

      Madhivanan, thanks for your response, we are not using client side
      cursor, but server side (the query work fine, adLockReadonly but it
      doesn't work when we use adLockOptimisti c) VB COM

      Comment

      • Erland Sommarskog

        #4
        Re: GROUP By clause or DISTINCT clause

        Jacek (jack.pedzikiew icz@gmail.com) writes:[color=blue]
        > Madhivanan, thanks for your response, we are not using client side
        > cursor, but server side (the query work fine, adLockReadonly but it
        > doesn't work when we use adLockOptimisti c) VB COM[/color]

        So the count we are talking about is Recordset.Recor dCount?

        What cursor type do you ask for? A query with GROUP BY or DISTINCT
        can only result in a static or forward-only cursor, and it cannot
        be updatable. A static cursor has a rowcount, a forward-only cursor
        has not.



        --
        Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

        Books Online for SQL Server SP3 at
        Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

        Comment

        Working...