dbTalk Databases Forums  

How to solve?

comp.databases.filemaker comp.databases.filemaker


Discuss How to solve? in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
giacomo Barlettani
 
Posts: n/a

Default How to solve? - 11-22-2010 , 12:07 PM






Hello
I have this problem:
Table 1 : customers
Table 2 : Products

Every customer buy several kind of products during the weeks of the
year.
I would like to have , for every customer, the total of the products
bought ,for ANY product.
i.e.:
customer 1 TOTAL : 100 product1, 120 Product2, 200 Product3 ......

How can I solve this?

THank you

Reply With Quote
  #2  
Old   
Lynn Allen
 
Posts: n/a

Default Re: How to solve?X-TraceApproved - 11-22-2010 , 01:16 PM






On 2010-11-22 10:07:20 -0800, giacomo Barlettani
<giacomobarlettani (AT) gmail (DOT) com> said:

Quote:
Hello
I have this problem:
Table 1 : customers
Table 2 : Products

Every customer buy several kind of products during the weeks of the
year.
I would like to have , for every customer, the total of the products
bought ,for ANY product.
i.e.:
customer 1 TOTAL : 100 product1, 120 Product2, 200 Product3 ......

How can I solve this?

THank you
Look up the concept of "join tables" to understand this.

You need Table 3: Purchases.

Each record has Customer ID, Product ID, and the quantity and date
purchased. Also the price if price is going to change over time.
Create the records through a portal in a Customer-based layout.

Every time a customer purchases an item, create a record in Purchases
recording date and product, quantity and price. Then, from the table
Purchases you can get the report you want. Sort by customer, then
product, and make subsummary parts.
--
Lynn Allen
--
www.semiotics.com
Member FBA
FM 10 Certified Developer

Reply With Quote
  #3  
Old   
 
Posts: n/a

Default Re: How to solve? - 11-22-2010 , 04:24 PM



Since every customer might buy many products AND any product might be bought
by several customers you will need a many-to-many relationship.
To set these up you need a third table, called the join table.
when a user orders a product you create a new record (called the join
record)
this will hold ONLY two fields. skCustomerID and skProductsID
Join::skCustomerID should form a relationship with Customers:kCustomerID
same for the skProductsID

pk = primary key
sk = secondary key

After that it's not too difficult figuring out how much a customer has
spent. You need a bit more work, but my guess is you will first have to
figure out more about many-2-many relationships.

--

Hou je goed / keep well,

Ursus

"giacomo Barlettani" <giacomobarlettani (AT) gmail (DOT) com> schreef in bericht
news:a8e1692f-0b77-4461-a2ec-232f4b0e149c (AT) j25g2000yqa (DOT) googlegroups.com...
Quote:
Hello
I have this problem:
Table 1 : customers
Table 2 : Products

Every customer buy several kind of products during the weeks of the
year.
I would like to have , for every customer, the total of the products
bought ,for ANY product.
i.e.:
customer 1 TOTAL : 100 product1, 120 Product2, 200 Product3 ......

How can I solve this?

THank you

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.