Extracting data from multiple fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimleon
    New Member
    • Nov 2006
    • 74

    Extracting data from multiple fields

    I have a table of customers business categories with 13 fields - customer, category1, category2, ....... category12. The first field contains the customers name and the next 12 contain categories, so the customer may have between 1 & 12 different categories (ie plumber, delivery driver). These category descriptions where generated from a pull down box on a form, from the table 'category'.
    I need to write a query to output tabulated results with each category listing all the customers who have selected that category thus...

    Architect
    Smith & sons
    wright ltd

    Electrician
    jones electrical
    wright ltd
    petersons

    Builders
    petersons

    etc...

    Any help would be most appreciated.

    Thanks in advance guys
  • George Oro
    New Member
    • Jan 2007
    • 36

    #2
    Not so sure if this will help but try Crosstab Query.

    I believe its more easy to make some queries if you will change your structure. Make one new table e.g tblCustomerCate gory then add 3 fields:
    CustomerID - this will link to the main customer table
    Category - same approach
    Timestamp - default value now() just for your info when the record inserted.

    from the structure you are not limited.

    HTH,
    George







    Originally posted by jimleon
    I have a table of customers business categories with 13 fields - customer, category1, category2, ....... category12. The first field contains the customers name and the next 12 contain categories, so the customer may have between 1 & 12 different categories (ie plumber, delivery driver). These category descriptions where generated from a pull down box on a form, from the table 'category'.
    I need to write a query to output tabulated results with each category listing all the customers who have selected that category thus...

    Architect
    Smith & sons
    wright ltd

    Electrician
    jones electrical
    wright ltd
    petersons

    Builders
    petersons

    etc...

    Any help would be most appreciated.

    Thanks in advance guys

    Comment

    • jimleon
      New Member
      • Nov 2006
      • 74

      #3
      Still not sure how that would work as I have 3 lists of data to work with, customer, category (1-12) and the category description.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32645

        #4
        Try working from something like this :
        Code:
        SELECT Customer
        FROM Categories
        WHERE Category1 & Category2 & Category3 & Category4 & Category5 & Category6 & Category7 & Category8 & Category9 & Category10 & Category11 & Category12 Like '*' & [Enter required Category] & '*'

        Comment

        • jimleon
          New Member
          • Nov 2006
          • 74

          #5
          Thanks NeoPa
          That works fine.

          Cheers

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32645

            #6
            My pleasure.
            It's good to be able to post ideas rather than the full solution with all i's dotted and t's crossed for a change :)

            Comment

            Working...