这是种关联如何做

#1 smseo

有3个表

A表 分类
字段
A_id         A_name
1             张三
2            李四
3           王五
4          赵六



B表 留言
字段
B_id   B_class
1           2
2           2
3          1
4            3
B_class 对应是 A表中的 A_id




c表 流量
字段
C_id    C_class
1           2
2            4
3          4
4           3
C_class 对应是 A表中的 A_id




现在想得到结果是


分类                       留言数                      流量数
---------------------------------------------------
张三                       1                              0
李四                      2                              1
王五                      1                             1
赵六                      0                             2


这是种关联如何做?






2012-06-10 11:51:35

#2 jake

看手册
http://www.speedphp.com/model-linker-limit.html

{:soso_e160:}(不看手册就提问计算2)

2012-06-10 20:55:56