# BAQ threeway

**URL:** <https://www.epiusers.help/t/baq-threeway/57874>\
**Category:** Epicor ERP 10\
**Tags:** baq\
**Created:** [July 17, 2019, 8:03pm UTC](https://www.epiusers.help/t/baq-threeway/57874 "2019-07-17T20:03:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [July 17, 2019, 8:03pm UTC](https://www.epiusers.help/t/baq-threeway/57874/1 "2019-07-17T20:03:17Z")

</div>

So I have an admittedly odd join, but I need to join these tables so that I get a row with any of the three tables have something n it. As shown below. The problem that I am having is that it looks like it looks for a join in table1 to table2, and if there isn’t join there, doesn’t do table 1 to table 3. It treats them like they don’t match I can change the behavior by changing the order of the tables, but it will always leave off the last table and just make a new row…

 ![image](https://epiusers.help/uploads/default/original/3X/e/8/e8ec23525284e82700e8b782b1c24251fe27dc94.png)

These two rows should be 1 row.

 ![image](https://epiusers.help/uploads/default/original/3X/4/f/4f76802c60f3657362208f112e451a23da85918e.png)

Is there a better way to make a join like this? Should I put this in the suqbqery criteria instead? Or do I need yet another level to make this work? (this query already has 9 subs plus the top level, lol)

---

<div class="post-metadata">

**Author:** ![MikeGross](https://www.epiusers.help/user_avatar/www.epiusers.help/mikegross/32/14500_2.png) [@MikeGross](https://www.epiusers.help/u/MikeGross)\
**Post date:** [July 17, 2019, 8:13pm UTC](https://www.epiusers.help/t/baq-threeway/57874/2 "2019-07-17T20:13:03Z")

</div>

I think you need another level(s) - either a sub to join two of them first, or make all three tables into a UNION subquery to the parent…

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [July 17, 2019, 8:14pm UTC](https://www.epiusers.help/t/baq-threeway/57874/3 "2019-07-17T20:14:07Z")

</div>

Union won’t put them onto the same row. I need them in separate columns but on the same row.

---

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [July 17, 2019, 8:23pm UTC](https://www.epiusers.help/t/baq-threeway/57874/4 "2019-07-17T20:23:24Z")

</div>

Join the first 2 tables in a subquery, then join the subquery to the top table.

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [July 18, 2019, 3:54pm UTC](https://www.epiusers.help/t/baq-threeway/57874/5 "2019-07-18T15:54:46Z")

</div>

I ended up going a little different direction and instead of doing the joins that way (in order to get that calculated field at the beginning with the job information in one column) I ended up using the XML path method. I can adjust what I am doing in my Bartender report to work with page breaks and start of group headers to make this work.
