# Query with join

**URL:** <https://community.dreamfactory.com/t/query-with-join/301>\
**Category:** REST API\
**Created:** [September 1, 2014, 7:59am UTC](https://community.dreamfactory.com/t/query-with-join/301 "2014-09-01T07:59:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![danar](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@danar](https://community.dreamfactory.com/u/danar)\
**Post date:** [September 1, 2014, 7:59am UTC](https://community.dreamfactory.com/t/query-with-join/301/1 "2014-09-01T07:59:29Z")

</div>

Hi, I’m new on Dreamfactory and I’m searching a solution to my problem.

I have a MySQL db with no relations between tables defined at database level but it’s for me necessary to do some queries with join. I can’t create table views (I can only read data on this db).

How can I do this with Dreamfactory ? If it’s possible, there is an example ?

Thanks in advance for any help.  
Danar

---

<div class="post-metadata">

**Author:** ![Mark](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mark/32/69_2.png) [@Mark](https://community.dreamfactory.com/u/Mark)\
**Post date:** [September 1, 2014, 11:49pm UTC](https://community.dreamfactory.com/t/query-with-join/301/2 "2014-09-01T23:49:05Z")

</div>

Hi, you’re able to create a stored procedure and call that to perform joins on a mysql db… You simply create the procedure and then call it using a GET via the live api.

If you want to study up on this, familiarize yourself with how exactly the users/roles system works. Because this has an important impact on knowing what you’re giving your users access to when simply doing a GET on a stored proc. Effectively, data can be manipulated through the stored proc without even giving the user delete/update access to that rest verb.

Thanks,  
Mark

---

<div class="post-metadata">

**Author:** ![danar](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@danar](https://community.dreamfactory.com/u/danar)\
**Post date:** [September 2, 2014, 9:25am UTC](https://community.dreamfactory.com/t/query-with-join/301/3 "2014-09-02T09:25:54Z")

</div>

Thanks for you reply.  
I try to do as you told me.

Danar

---

<div class="post-metadata">

**Author:** ![tborja](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/tborja/32/81_2.png) [@tborja](https://community.dreamfactory.com/u/tborja)\
**Post date:** [October 21, 2014, 11:09am UTC](https://community.dreamfactory.com/t/query-with-join/301/4 "2014-10-21T11:09:07Z")

</div>

Mark,

Is there any particular reason you are recommending the creation of a stored procedure instead of just creating a view that has a join?

---

<div class="post-metadata">

**Author:** ![toddappleton](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/toddappleton/32/159_2.png) [@toddappleton](https://community.dreamfactory.com/u/toddappleton)\
**Post date:** [October 21, 2014, 4:07pm UTC](https://community.dreamfactory.com/t/query-with-join/301/5 "2014-10-21T16:07:51Z")

</div>

The OP said he could not create views.

---

<div class="post-metadata">

**Author:** ![abhijitmehta](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/abhijitmehta/32/439_2.png) [@abhijitmehta](https://community.dreamfactory.com/u/abhijitmehta)\
**Post date:** [February 16, 2016, 2:18pm UTC](https://community.dreamfactory.com/t/query-with-join/301/6 "2016-02-16T14:18:54Z")

</div>

One possible reason I could think of is you can pass variables to the procedure and find your query to work on them . If its a view , the filtering could be done on top of reocrd retrievals only ( as far as I have discovered DS , I didnt find a way of passing variables - either bind or literal to the query).

Does that make sense ?

---

<div class="post-metadata">

**Author:** ![mimu](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mimu/32/1183_2.png) [@mimu](https://community.dreamfactory.com/u/mimu)\
**Post date:** [February 16, 2016, 8:50pm UTC](https://community.dreamfactory.com/t/query-with-join/301/7 "2016-02-16T20:50:59Z")

</div>

Would it not be easier to use DataMesh  
like described in the Blogpost below ?

Virtual Relationships Between Database Tables  
Posted by Lee Hicks  
Thu, Feb 4, 2016

> **[API Blog: Everything You Need to Know - Expert advice to help you instantly...](https://blog.dreamfactory.com/)**
>
> Expert advice to help you instantly create APIs and build applications faster
