如何从一个表中获取id,并从该id中获取另一个表中的所有数据 [英] How do I fetch the id from one table and from that id ihave to fetch all the data from another table

查看:71
本文介绍了如何从一个表中获取id,并从该id中获取另一个表中的所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i have two tables one is job table and other is resume table.i want to fetch resume against every job record. i have job id in resume table as jid. Means a person can post many resumes against many jobs.so, how can i list all the jobs and resume one person posted.Note: i also have users table. <a href="https://i.stack.imgur.com/XiqsY.png"></a>[<a href="https://i.stack.imgur.com/XiqsY.png" target="_blank" title="New Window">job table pic</a>] and <a href="https://i.stack.imgur.com/KzKwX.png"></a>[<a href="https://i.stack.imgur.com/KzKwX.png" target="_blank" title="New Window">resume table</a>] 
and my point is to show the records as
<pre lang="text">
    ------------------------------------------------
     my job posted job |   resumes against that job |
    -------------------|----------------------------|
     job1              |   resume1                  |
                       |                            |
    ------------------------------------------------





我尝试过:



i已经尝试了很多,但我是新的db,所以你能帮助所有吗?



What I have tried:

i have tried much but im new too db so can you please help all?

推荐答案

使用SQL JOIN:

Use an SQL JOIN:
SELECT u.*, j.*, r.* FROM Jobs j
JOIN Resumes r ON j.ID = r.jid
JOIN Users u ON u.ID = i.uid
WHERE u.ID=3


这篇关于如何从一个表中获取id,并从该id中获取另一个表中的所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆