• Evil Kraig F (8/7/2014)


    rodrigo_fabiam (8/7/2014)


    Hi, Evil Kraig F.

    There is not this colums.

    It is because this that I want to show this way for the user.

    Because they will have to mark what site is each kit. At the end, it will like this way:

    How do you know what goes into each kit? The solution above by Luis will give you what you need with what's presented, but it comes with a concern: Your association is completely random. It's going to sort out in whatever order the database coughs it up in, and won't deal with, for example, two kit sets repeated 3 times each. At least not well.

    Your example is oversimplified for a production system, because it just can't work that way long term because there's no associations outside of a single table's row order. If you've got other controls already making sure that you're restricting it to a single kit type for a single invoice (I'm making a crapload of assumptions here), then Luis' solution will work. Otherwise, you'll need to get us a more holistic view of your schema to help you not shoot yourself in the foot.

    Very valid points by Kraig.

    If that is truly representative of a production system, then somebody has a nightmare worth of assumptions to make about the data.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events