Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
553 views
in Technique[技术] by (71.8m points)

mysql 多表查询加统计大神来看看

图片描述

图片描述

图片描述

如图 三张 表 现在需要 查询出 ! baojia表中xq_id的次数 还有 xuqiu表中u_id等于 user表中的user_id

意思就是 用户表里的人发了个需求 然后报价表里记录报价 然后统计


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

需要关联查询,sql如下:

select xq_id from baojia t1 
    inner join user t2
    on t1.u_id = t2.user_id 
    inner join xuqiu t3
    on t3.u_id = t2.user_id

具体需求不太了解,如果xq_id次数需要sum的话,请自行sum并group by


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...