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! 🙂

    filefor product
    file1A,F,W,Z
    file2A,W,G
    file3Z,W

    ProductFiles
    Afile1, file2
    Ffile1
    Wfile1, file2, file3
    Zfile1, file3
    Gfile2

  • 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