cancel
Showing results for 
Search instead for 
Did you mean: 

UNION magento query

UNION magento query

SELECT name AS name, NULL as productname, NULL AS Offlinedb_id, entity_id AS entity_id , producttype_value AS producttype_value
        , url_path AS url_path, dosageform_value AS dosageform_value, fobprice AS fobprice, fobpricecurrency_value AS fobpricecurrency_value, fobpriceunit_value AS fobpriceunit_value, leadtime AS leadtime, leadtimeperiod_value AS leadtimeperiod_value, healthfunction_value AS healthfunction_value, NULL AS ptype, NULL AS productcategory, NULL AS country, NULL AS companyname, NULL AS city	
		FROM `catalog_product_flat_1` a
		WHERE (
		a.name LIKE '%".$filter."%'
		)
		UNION ALL 
		SELECT NULL , productname AS productname, Offlinedb_id AS Offlinedb_id , NULL, NULL, NULL ,NULL, NULL, NULL, NULL, NULL, NULL, NULL, producttype AS ptype, productcategory AS productcategory, country AS country, companyname AS companyname, city AS city
		FROM `Offlinedb` b
		WHERE (
		b.productname LIKE '%".$filter."%' 
		)

How to create this direct sql query to magento query.

UNION ALL ----- 

 

 

Thanks

CEMK