left Join between two tables
left Join between two tables
Hi, Im try to do a left Join between two tables
table 1 products_shop
id_product | price
1 | 34$
table 2 product
id_product . | . reference
1 | Pen
Im try that the result will be this table
Id_product . | reference . . | price
1 . | pen . | 34€
With this code
Editor::inst( $db, 'product_shop')
->fields(
Field::inst( 'product_shop.id_product' ),
Field::inst( 'product_shop.price' ),
Field::inst( 'product.reference' )
)
->leftJoin('reference as primary', 'product_shop.id_product', '=', 'product.id_product' )
->process( $_POST )
->json();
show a errror
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'primary ON product_shop.id_product = product.id_product at line 1
where is the problem? Thank you very much for the help.
Answers
whit this code
No show error.. but don´t show any result in table..
Can you add the
debug()
option:Then use the debugger to take a trace of the table when it loads and let me know what the debug code is please?
Thanks,
Allan
Thanks allan,
this is the debug code ?
https://debug.datatables.net/ezecen
Thanks for the debug code. It shows that DataTables hasn't made an Ajax request at the time when the debugger was run.
Are there any errors shown in your browser's console?
Thanks,
Allan
Thank allan i do changes..
with this code..
show this error..
and this ( show 2 error )
the debug code is this...
https://debug.datatables.net/iduzub
What do you think it can be? they are only two tables ..
thank you very much for your help.
This is my SQL query
and the result that i want
I do it!
now is working. Thanks!!!