SQL Server Performance

(DEAD) How to merge rows in the same table?

Discussion in 'General DBA Questions' started by SQLess, Sep 30, 2003.

  1. SQLess New Member

    Nevermind.
    This won't be feasible in my case due to data integraty issue.
  2. Luis Martin Moderator

    I'm not a developer.
    Ony way I see is having a same key for each question and his answer.
    I suggest wait for anothers members.



    Luis Martin

    ...Thus mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true.
    Bertrand Russell
  3. NewDBA Member

    IF the id in your table goes one right after an other (1,2,3,4,5,6...)

    then you can do this :

    SELECT * FROM
    (SELECT ID,TYPE,REV FROM TESTA A WHERE TYPE='A' )A,
    (SELECT ID,TYPE,REV FROM TESTA A WHERE TYPE='B' )B
    WHERE B.ID=A.ID+1
  4. SQLess New Member

    <blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by NewDBA</i><br /><br />IF the id in your table goes one right after an other (1,2,3,4,5,6...)<br /><br />then you can do this :<br /><br />SELECT * FROM<br />(SELECT ID,TYPE,REV FROM TESTA A WHERE TYPE='A' )A,<br />(SELECT ID,TYPE,REV FROM TESTA A WHERE TYPE='B' )B<br />WHERE B.ID=A.ID+1<br /><hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"><br /><br />unfortuately, they aren't <img src='/community/emoticons/emotion-6.gif' alt=':(' />

Share This Page