# Related table doesn't appear

**URL:** <https://community.dreamfactory.com/t/related-table-doesnt-appear/2885>\
**Category:** REST API\
**Created:** [June 25, 2016, 12:27am UTC](https://community.dreamfactory.com/t/related-table-doesnt-appear/2885 "2016-06-25T00:27:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omar\_Guzman](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omar\_Guzman](https://community.dreamfactory.com/u/Omar_Guzman)\
**Post date:** [June 25, 2016, 12:27am UTC](https://community.dreamfactory.com/t/related-table-doesnt-appear/2885/1 "2016-06-25T00:27:19Z")

</div>

I’m not able to detect a related table from a call here is what I am doing.  
My data is in a MySQL db  
From the API docs I run /tablename/\_schema/{table\_name}  
The resulting response shows this:  
“related”: [],

However this table is related to three other tables. The table structure is this  
id | schedule\_id | member\_id | role\_id  
schedule\_id is related to another table called “schedules” so it relates like this:  
this table schedule\_id = schedule table id

Since it doesn’t detect the related table I am unable to pull data from multiple tables.  
Is there away I can manually tell the call that this table = another one? I’ve read on the docs that a stored procedure is the way to accomplish this but I thought maybe there was an easier way in 2.2

Ultimately I want to make one call and get data from more than two tables and indicate what data I’d like.

In an sql query it b something like this:  
SELECT DISTINCT b.date\_schedule, b.time\_type, a.first\_name, a.last\_name, [c.name](http://c.name)  
FROM dr\_persons a  
iNNER JOIN dr\_schedules b  
iNNER JOIN dr\_types c

I saw there is a “related data when relationships don’t exist” post and it says it’s not possible but I’m not sure if it now is in 2.2 Any help would be great, thank you

UPDATE: I actually did this using data mesh. Virtual relations

---

<div class="post-metadata">

**Author:** ![navarathinam](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@navarathinam](https://community.dreamfactory.com/u/navarathinam)\
**Post date:** [August 22, 2016, 3:51pm UTC](https://community.dreamfactory.com/t/related-table-doesnt-appear/2885/2 "2016-08-22T15:51:52Z")

</div>

I am also facing same in google cloud platform. Dreamfactory version is 2.2.  
Anyone find solution for this query???

Thanks in advance

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [August 26, 2016, 8:02pm UTC](https://community.dreamfactory.com/t/related-table-doesnt-appear/2885/3 "2016-08-26T20:02:46Z")

</div>

DreamFactory pulls the foreign key relationships from the database itself. If DreamFactory does not detect any relationships, you can create virtual relationships using the Schema editor.

[https://wiki.dreamfactory.com/DreamFactory/Tutorials/Using\_virtual\_foreign\_keys](https://wiki.dreamfactory.com/DreamFactory/Tutorials/Using_virtual_foreign_keys)

---

<div class="post-metadata">

**Author:** ![navarathinam](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@navarathinam](https://community.dreamfactory.com/u/navarathinam)\
**Post date:** [August 27, 2016, 6:53am UTC](https://community.dreamfactory.com/t/related-table-doesnt-appear/2885/4 "2016-08-27T06:53:41Z")

</div>

DreamFactory schema editor allows to create relationship with one to one. In my case, i have one parent and multiple child. All child table refer the same primary key column in parent table.

Example:  
SELECT  
p.people\_id, p.firstname, p.lastname, pa.address, pa.city, pa.country, sa.address, sa.city, sa.country  
FROM people AS p  
LEFT JOIN primary\_address AS pa ON p.people\_id = pa.people\_id  
LEFT JOIN secondary\_address AS sa ON p.people\_id = sa.people\_id;

How to make people\_id as foreign key of both primary\_address and secondary\_address table?

Any Idea how I can apply this?

Thank you

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [August 29, 2016, 3:02pm UTC](https://community.dreamfactory.com/t/related-table-doesnt-appear/2885/5 "2016-08-29T15:02:59Z")

</div>

This is something you SHOULD be able to do, but I’m seeing some issues with it. Let me circle up with our engineering team and get back to you.
