help with table query

  • The first table is a SQL table. A specific file is suitable for specific products. I want to produce a view like the second table, in this way I can display the files that are suitable for a specific product. What is the best way to set this query up? I need the VB 'split' command to split the products from the 'for product' field in the first table. After the split, in which each product get's 1 row, I want to sum all files that are suitable. Is this possible? Thank you in advance! 🙂

    file for product
    file1 A,F,W,Z
    file2 A,W,G
    file3 Z,W

    Product Files
    A file1, file2
    F file1
    W file1, file2, file3
    Z file1, file3
    G file2

  • I'll go for a function which returns a table and pass in which product(s) your are interested in.

  • you should start by normalising:

    have a file table and a product table, then have a join table

    file

    ----

    file 1

    file 2

    file 3

    Product

    -------

    A

    F

    W

    Z

    G

    File_Product table

    File    Product

    ---    -------

    file 1  A

    file 1  F

    ...

    file 2  A

    file 2  W

    ...

    ...

     

    From the join table you can use functions to concatonate / aggregate to produce either of your example tables.

  • Thanks it worked! On the page that displays the results I select the right records from the view through a browser querystring

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

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