BigRed1212
Technical User
I don't know how to even set this up.
I have data that look like this:
This is application data. In this data set, Tom applied to 3 places, and Joe to 2.
What I want to be able to do is to say in it's simplest form is: Of those who applied to place a, where else did they apply?
A little more complex it is: Of those who applied to place a, what are the top 3 places those people also applied to (maybe even in percentage terms)?
For this dataset, we have 2 applicants to place a (Bill did not apply). I want to be able to show that those two applicants also both applied to place u and that places f and i round out the top 3 choices.
My results presentation would look like:
Place applied to: a
Number of people that applied: 2
Most popular place that these people also applied to: u
Number that also applied to u: 2 (100%)
2nd most pop additional place: f
Number that also applied to f: 1 (50%)
3rd most pop additional place: i
Number that also applied to u: 1 (50%)
I think
shows me the top places applied to by everybody, but I want this by place and people. The top 3 places for those who applied to place a, the top three for those who applied to place b, the top 3 for those who applied to place c, etc. I have 18,000 records but I only have 12 places so I'll run a working query 12 times (once for each place) if needed. I think some sort of self join is probably in order but I don't really get those or how to do it.
Let me know if something isn't clear or you have questions. Thanks for reading this far and thanks in advance if you can give me a suggestion or two on how to proceed.
I have data that look like this:
Code:
fname ident place applied accepted
bill 345 a 0 0
bill 345 b 0 0
bill 345 c 0 0
jane 234 d 1 1
jimmy 456 u 1 1
jimmy 456 f 1 1
jimmy 456 a 1 1
joe 123 g 1 1
joe 123 h 1 0
joe 123 b 0 0
jorge 678 e 1 0
tom 567 u 1 0
tom 567 i 1 0
tom 567 a 1 0
This is application data. In this data set, Tom applied to 3 places, and Joe to 2.
What I want to be able to do is to say in it's simplest form is: Of those who applied to place a, where else did they apply?
A little more complex it is: Of those who applied to place a, what are the top 3 places those people also applied to (maybe even in percentage terms)?
For this dataset, we have 2 applicants to place a (Bill did not apply). I want to be able to show that those two applicants also both applied to place u and that places f and i round out the top 3 choices.
My results presentation would look like:
Place applied to: a
Number of people that applied: 2
Most popular place that these people also applied to: u
Number that also applied to u: 2 (100%)
2nd most pop additional place: f
Number that also applied to f: 1 (50%)
3rd most pop additional place: i
Number that also applied to u: 1 (50%)
I think
Code:
SELECT top 3 place, count(place) as counter
from table1
where applied = 1
group by place
order by 2 desc
shows me the top places applied to by everybody, but I want this by place and people. The top 3 places for those who applied to place a, the top three for those who applied to place b, the top 3 for those who applied to place c, etc. I have 18,000 records but I only have 12 places so I'll run a working query 12 times (once for each place) if needed. I think some sort of self join is probably in order but I don't really get those or how to do it.
Let me know if something isn't clear or you have questions. Thanks for reading this far and thanks in advance if you can give me a suggestion or two on how to proceed.