|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Frequency counts with two tables
Hi all,
I'm looking for assistance with a sql query to generate a frequency count from two columns in one table for iterated values in another table. I've simplified this to an example using customer purchases from stores. One table has the customer id numbers and another table lists facility number and number of purchases. What I'm looking for is how to output the frequency of purchases for each customer for each facility. Not all customers in table 1 are in table 2. Table 1 fields / Customers -------------------------------- customer,field2,.. 1 2 3 Table 2 fields / Purchases -------------------------------- customer, facility, purchases 1 5 2 1 5 1 2 1 1 2 1 1 For each customer in Table 1 I'd like to know how many purchases were made in each facility. So I'd like a query that would show customer , facility , purchases 1 , 1 , 0 1 , 5 , 3 2 , 1 , 2 Thanks for advice or pointers. LI |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Frequency counts with two tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|