Hi all,
I have 2 tables:
Stats_table & output_table
In stats table there are 10k records, with a unique ID (inst_ID).
In output table there will be several thousand records of customers, and each customer also has an inst_ID assigned.
What I need to do is for every unique inst_ID in the stats table, count how many times this ID occurs in the output_table and display the total.
There is also an additional column in the output_table called cust_frequency. In the same query I also need to sum the cust_frequency total for each inst_id
So my results may look something like:
inst_ID countfromoutput_table sumOfFrequency
1234 50 500
2345 5 10
4555 20 100
I need to return all records from the stats_table regardless of whether or no there are any matches in the output_table
Hope that makes sense and hope someone can help.
Much appreciated
I have 2 tables:
Stats_table & output_table
In stats table there are 10k records, with a unique ID (inst_ID).
In output table there will be several thousand records of customers, and each customer also has an inst_ID assigned.
What I need to do is for every unique inst_ID in the stats table, count how many times this ID occurs in the output_table and display the total.
There is also an additional column in the output_table called cust_frequency. In the same query I also need to sum the cust_frequency total for each inst_id
So my results may look something like:
inst_ID countfromoutput_table sumOfFrequency
1234 50 500
2345 5 10
4555 20 100
I need to return all records from the stats_table regardless of whether or no there are any matches in the output_table
Hope that makes sense and hope someone can help.
Much appreciated