Break Report from SQL Query

  • Hi

    How can I produce Break report from a query like in Oracle. For example, if the following is the output of a query:

    pub_id type title_id

    ------ ------------ --------

    0736 business BU2075

    0736 psychology PS2091

    0736 psychology PS2106

    0736 psychology PS3333

    0736 psychology PS7777

    0877 mod_cook MC2222

    0877 mod_cook MC3021

    0877 UNDECIDED MC3026

    0877 psychology PS1372

    0877 trad_cook TC3218

    0877 trad_cook TC4203

    0877 trad_cook TC7777

    1389 business BU1032

    1389 business BU1111

    1389 business BU7832

    1389 popular_comp PC1035

    1389 popular_comp PC8888

    1389 popular_comp PC9999

    I would need them as

    pub_id type title_id

    ------ ------------ --------

    0736 business BU2075

    psychology PS2091

    psychology PS2106

    psychology PS3333

    psychology PS7777

    0877 mod_cook MC2222

    mod_cook MC3021

    UNDECIDED MC3026

    psychology PS1372

    trad_cook TC3218

    trad_cook TC4203

    trad_cook TC7777

    1389 business BU1032

    business BU1111

    business BU7832

    popular_comp PC1035

    popular_comp PC8888

    popular_comp PC9999

    Thanks in advance.

    Anbarasan Mani

  • You'd have to write some type of loop or some complicated SQL to get this. Not sure how to remove the pub_id from the duplicate lines.

    Steve Jones

    sjones@sqlservercentral.com

    http://qa.sqlservercentral.com/columnists/sjones

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply