Adding join within sub query breaks query

Wappler Version : 4.9.1
Operating System : win 10
Server Model: PHP
Database Type: mariaDB
Hosting Type: Wamp

Expected behavior

What do you think should happen?

Query should return results but query breaks

I have an invoice table with a sub table of invoice items

I also have customer, shipping address and invoice address tables which i link with joins

I have a query which selects an invoice, items from the sub table and also joins to the customer, shipping and invoice address tables

The query returns data exactly as i would expect

However io need to pull product names from the products table, linked to the product_id field ion teh invoice_items sub table

image

So i open the table query builder

Select the subtable

open it

image

I then add a join to the sub query to link the products table

and add the product name

image

I then save and run the query and get this error

Invoice_id is part of the query as can be seen above

API file content
get_invoice_by_id.zip (2.0 KB)

@Teodor , any feedback?

I see that you have called your sub table invoice_items while being a sub table already gets the invoice_prefix

So you final table name in the database ends up with double invoice_ prefix.

You can just call the sub table “items” when creating it as such. It will get the right prefix of its parent table.

Maybe that is the root cause of your issue.

Thanks George. I did spot that and actually rebuilt the query from scratch but same issue. Am on holiday in Tenerife now so may not get access to check again until next Wednesday.

1 Like