Select from table with to colums in to different levels

  • Hello, I have a SQL table with two columns that contain numbers. The first column is the upper level an the second the under level. The problem is that the under level is also again in the first column and it has his own under levels. So the first under level is in the first column and has its under level that is also the second under leve from the first column and so on.

     It should look something like that after the select statement.

    The SQL table looks similar to that. At the end is the quantity.

    Does any body have an ide how to get to that.

  • Don't post images, post data as text. See the link in my signature on how to post sample data and expected results, and it'll be much easier for someone to help you. 🙂

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • simon.vasiljevic - Friday, June 15, 2018 4:07 AM

    Hello, I have a SQL table with two columns that contain numbers. The first column is the upper level an the second the under level. The problem is that the under level is also again in the first column and it has his own under levels. So the first under level is in the first column and has its under level that is also the second under leve from the first column and so on.

     It should look something like that after the select statement.

    The SQL table looks similar to that. At the end is the quantity.

    Does any body have an ide how to get to that.

    I'm not entirely sure what you are asking for.   If you are looking for output that is graphical and demonstrates the hierarchical nature of your data, that's not going to happen just by using a query.  I'm also pretty sure even SSRS (a reporting tool) probably can't do that.   You will likely need to  find a custom control that handles hierarchical data, and custom program it.   If you're asking for something else, let me know...

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

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

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