php - Searching multiple databases to output lowest value -


$query = mysqli_query($mysqli, "select product_name ,min(product_price) product_price,link from( select jumia.product_name,jumia.product_price,jumia.product_image,jumia.link jumia inner join jumia on jumia.id = olx.id  product.name '%{$search}%' union select olx.product_name,olx.product_price,olx.product_image, olx.link olx inner join olx on olx.id =  jumia.id product.name '%{$search}%')minim group product_name,product_image "); 

i trying create query 2 tables similar column names displayed above allow me display rows between 2 tables have lowest price.

for example, if product_name called mattresses searched matching item in database price lower between 2 table names should displayed. appreciated

i think general idea of you're trying do:

select id, price (select id, price t1 price = (select min(price) t1)       union       select id, price t2 price = (select min(price) t2)      ) m order price asc limit 1 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -