Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81929

left Join between two tables

$
0
0

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.


Viewing all articles
Browse latest Browse all 81929

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>