I want to add columns that represent counts from other tables.
I have 3 tables.
Messages
MessageID User Message Topic 1 Tom Hi ball 2 John Hey book 3 Mike Sup book 4 Mike Ok book
Topics
Topic Title Category1 Category2 ball Sports Action Hot book School Study Hot
Stars_Given
starID Topic 1 ball 2 book 3 book 4 book
I want to end up with:
Topic_Review
Topic Title StarCount UserCount MessageCount ball Sports 1 1 1 book school 3 2 3
So basically I want to attach 3 columns with counts of unique values (number of stars given within each topic, unique users who have messages within topic, and the number of unique messages in each topic).
I want to eventually be able to filter on the categories (look in both columns) as well.
Also, I want to eventually sort by the counts that I join. Example, I'm going to have a button that sorts by "number of stars" by ascending order, or sort by "number of users" by descending order, etc.
I've tried adapting other people's answers and I can't get it to work properly.
0 answers
Hot tools Tags
Hot Questions
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
20519
7
13632
4






