sql help (joins i think)
Posted: Mon Aug 06, 2012 2:43 am
Hi Guys,
I'm in the process of integrating my store with a service called StoreFeeder. I'm 90% of the way there just have this final task to do.
I've been given this SQL code which is in a file that I've uploaded to the OC server. I need to amend code to be compatible with OC field schema. I'm not at all good with SQL and joins and looking at the fields they need it seems to be across multiple tables.
I'm running OC 1.4.9.3
Really grateful for any advice or guidance.
I'm in the process of integrating my store with a service called StoreFeeder. I'm 90% of the way there just have this final task to do.
I've been given this SQL code which is in a file that I've uploaded to the OC server. I need to amend code to be compatible with OC field schema. I'm not at all good with SQL and joins and looking at the fields they need it seems to be across multiple tables.
I'm running OC 1.4.9.3
Really grateful for any advice or guidance.
Code: Select all
/*
* Product Download Query
*
* This query is responsible for fetching all products from your website.
*
* It should return all products that you want to send to StoreFeeder.
*
* Required fields are sku, name and price_ex_vat. Other fields also have to be present in
* the output of the query, but may be left empty (see example in the comments
* to the Orders Query about empty fields).
*
* Note that you can 'hardcode' some of the fields, e.g. you could enter:
*
* ... 'Default Warehouse' as 'warehouse'...
* if you want all your products to be assigned to the 'Default Warehouse' inside StoreFeeder
*
*/
$productDownloadQuery = "SELECT
`product.[sku]` AS 'sku',
` product_description.name` AS 'name',
`` as 'description',
`product.[price]` as 'price_ex_vat',
`vat_percent` as 'vat_percent',
`` AS 'rrp',
`` as 'cost',
`` as 'weight',
`` AS 'mpn',
`` as 'supplier',
`` as 'warehouse',
`` as 'inventory',
`` as 'ean',
`` as 'upc',
`` as 'image_url',
`` as 'website_url'
FROM product INNER JOIN product_description ON product.product_id = product_description.product_id";