help with for xmp explicit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chanko@gmail.com

    help with for xmp explicit

    i have a situation, where i need to group my information by a certain
    id, but that information which should already be grouped, i need to
    order based on a number in one of the columns

    example:

    <ex id=2 listorder=1>
    <description>de sc 2</description>
    </ex>
    <ex id=1 listorder=2>
    <description>de sc 1</description>
    </ex>

    in my order clause i first put order by the id, and it will group the
    information accordingly, but will put the lowest number id first, not
    caring about the listorder

    but if i order by the listorder column first, the information isn't
    groupd properly

    i don't know if i made myself clear enough?
    hope someboyd can help me
    thnx in advance

  • Erland Sommarskog

    #2
    Re: help with for xmp explicit

    (chanko@gmail.c om) writes:[color=blue]
    > i have a situation, where i need to group my information by a certain
    > id, but that information which should already be grouped, i need to
    > order based on a number in one of the columns
    >
    > example:
    >
    ><ex id=2 listorder=1>
    > <description>de sc 2</description>
    ></ex>
    ><ex id=1 listorder=2>
    > <description>de sc 1</description>
    ></ex>
    >
    > in my order clause i first put order by the id, and it will group the
    > information accordingly, but will put the lowest number id first, not
    > caring about the listorder
    >
    > but if i order by the listorder column first, the information isn't
    > groupd properly
    >
    > i don't know if i made myself clear enough?[/color]

    A standard recommendation for this sort of questions is that you provide:

    o CREATE TABLE statement for your table(s).
    o INSERT statements with sample data.
    o The desired output given the sample.

    This permits people who try to help to easily copy data into Query
    Analyzer to develop a tested solution.


    --
    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...