I have a table called project and another table student. I want to fetch all the details about the project and all the details of the student in that project from single query. student table has project id as foreign key.There can be many students in a project.
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
在单个查询中从两个不同的表中获取详细信息
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
3条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
doufuxi7093 2016-06-02 17:25关注Select p.*,s.*(for all columns) from project p, Student s inner join p.id=s.id
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
评论按下Enter换行,Ctrl+Enter发表内容
报告相同问题?
提交
- 2017-04-08 20:14回答 3 已采纳 I would probably do this: SELECT COUNT(IF (username IS NOT NULL AND username != '', 1, NULL))
- 2018-04-17 05:22回答 1 已采纳 The code in the question does not work because the first decoder reads the entire request body. T
- 2014-10-24 13:26回答 1 已采纳 You can use IN : SELECT stregno, stname FROM students WHERE stregno IN ('$pn', '$rn') Or, a OR
- 2023-09-23 02:26AI天才研究院的博客 本文将从HBase的历史和特性出发,到其最新版本中所增加的新功能以及其在大数据应用中的作用。Apache HBase是一个分布式的、面向列的、可伸缩的存储系统,支持随机读写访问和实时分析查询,能够进行海量数据的维护、...
- 2019-07-25 19:48回答 1 已采纳 You are better off using a JOIN query, and then structure your array from the result - having a qu
- 2017-08-01 10:44回答 5 已采纳 In controller public function invoice($id) { $this->load->database(); $this->l
- 2017-05-02 17:06回答 1 已采纳 I suppose this could simply be a comment but I can't comment so: why not use UNION? SELECT 'User'
- 2023-03-09 15:15z1ztai的博客 在执行了分库分表之后,难以避免会将原本逻辑关联性很强的数据划分到不同的表、不同的库上,这时,表的关联操作将受到限制,我们无法join位于不同分库的表,也无法join分表粒度不同的表,结果原本一次查询能够完成的...
- 2017-08-01 17:47回答 2 已采纳 You can use Builder::whereIn and subqueries to achieve what you want: Model::whereIn("name", func
- 2010-02-24 04:25回答 1 已采纳 IF you can use a single connection for the query, it is trivial. You say that the schemas are on
- 2020-03-06 02:30回答 7 已采纳 我不知道理解的意思对不对,你要把结果二拼接到结果一右边? (select * from table1 where xx='xx') as table2 left join (select * f
- 2024-10-12 21:47青云交的博客 本文深入全面且细致入微地阐释了差分隐私技术在大数据隐私保护中的实际应用。详细剖析了其基本原理,包括基于精准无误的概率的隐私预算调控以及噪声添加机制,通过医疗和金融领域的典型生动案例展示应用效果,深入...
- 2020-10-29 14:51000X000的博客 问题导读: 1、项目中遇到过哪些问题?...调整参数:yarn.scheduler.maximum-allocation-mb(单个任务可申请的最多物理内存量,默认是8192MB)(2)如果写入文件过量造成NameNode宕机。那么调高Kafka的存储大
- 2021-10-09 23:10单列索引基于单个列,而组合索引(复合索引)基于两个或更多列,创建时应考虑列的选择性和查询过滤条件。 在创建组合索引时,应将过滤条件的列作为引导列,选择性高的列放在前面,以减少扫描的leaf block数量。JOIN...
- 2025-01-08 16:33我科绝伦(Huanhuan Zhou)的博客 MySQL大数据表处理策略全解析
- 没有解决我的问题, 去提问