MySQL Query Shows Inconsistent Result Everytime -


select distinct pv.product_variation_key,                 p.product_key,                 p.brand_key,                 p.name,                 p.vehicle_type,                 p.short_description,                 pp.medium_image,                 b.brand_name,                 b.big_image,                 ts.tire_size,                 pv.sku,                 pv.price,                 pv.dealer_price,                 pv.retail_price,                 pv.weight,                 pv.width,                 pv.performance_rating,                 pv.mileage_warranty,                 pv.overall_diameter,                 pv.tread_depth,                 pv.maximum_psi,                 vte.road_hazard,                 vte.road_hazard_price,                 vte.load_index,                 vte.sidewall,                 vte.utqg,                 vte.load_ply_rating,                 vte.load_range,                 tsr.tire_speed_rating,                 cr.rating,                 if(pv.sku != i.sku,'true','false'),                 round((((acos(sin((41.3309413*pi()/180)) * sin((sc.latitude*pi()/180)) + cos((41.3309413*pi()/180)) * cos((sc.latitude*pi()/180)) * cos((abs(-75.7429636 - sc.longitude)*pi()/180))))*180/pi())*60*1.1515) , 1) distance (products p,       product_variations pv,       brands b,       tire_sizes ts,       variation_tire_size_applications vts,       variation_tire_extradatas vte,       inventorys i,       supply_chain_centers sc) left join customer_reviews cr on cr.product_key = p.product_key , cr.is_approved = 'yes' left join variation_tire_speed_rating_applications vtsra on vtsra.product_variation_key = pv.product_variation_key left join tire_speed_ratings tsr on vtsra.tire_speed_rating_key = tsr.tire_speed_rating_key left join product_photos pp on p.product_key = pp.product_key , pp.photo_type= 'default image' pv.product_key = p.product_key   , p.status = 'active'   , b.brand_key = p.brand_key   , pv.product_variation_key = vts.product_variation_key   , ts.tire_size_key = vts.tire_size_key   , pv.product_variation_key = vte.product_variation_key   , i.supply_chain_center_key = sc.supply_chain_center_key   , i.brand_key = p.brand_key   , sc.status = 'active'   , pv.sku=i.sku   , i.current_stock > 0   , (p.name '%win%'        or pv.variation_name '%win%'        or p.product_type '%win%'        or b.brand_name '%win%'        or lcase(pv.sku) '%win%') group pv.product_variation_key having (distance <= 1000) order pv.retail_price asc,          cr.rating desc,          p.name asc 

i have facing issue mysql query shows inconsistent result every time in phpmyadmin think issue happens because of latitude , longitude. please me solve problem.

simple rule when using group by:

every column in select clause must in group by clause or aggregate function must applied it!

if not case, random row out of each group displayed. mysql knowledge dbms allows this, remember, it's wrong. can disable setting only_full_group_by sql mode.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -