Help with Mysql query

Completed Posted 5 years ago Paid on delivery
Completed Paid on delivery

This query working

SELECT DATE_FORMAT(oo.date_added, '%m/%d/%Y') as Date, ot.order_id, round([login to view URL],2) as total, round(SUM([login to view URL]*[login to view URL]),2) AS weight, round(SUM([login to view URL]*p.cost_sk),2) AS product_cost,

(Select round(SUM([login to view URL]),2) from oc_order_total ot1 where [login to view URL] like 'tax' and ot1.order_id = oo.order_id) as tax,

(Select round(SUM([login to view URL])*-1,2) from oc_order_total ot2 where [login to view URL] like 'ultimate_coupons' and ot2.order_id = oo.order_id) as sconto,

(Select round(SUM([login to view URL]),2) from oc_order_total ot3 where [login to view URL] like 'low_order_fee' and ot3.order_id = oo.order_id) as low_order_fee,

(Select round(SUM([login to view URL]),2) from oc_order_total ot4 where [login to view URL] like 'category_product_based_fee' and ot4.order_id = oo.order_id) as isotermico,

(Select round(SUM([login to view URL])*-1,2) from oc_order_total ot5 where [login to view URL] like 'redeem_point' and ot5.order_id = oo.order_id) as points,

(Select round(SUM([login to view URL]),2) from oc_order_total ot6 where [login to view URL] like 'suppcontr' and ot6.order_id = oo.order_id) as contrassegno,

(Select [login to view URL] from oc_order_total ot7 where [login to view URL] like 'ultimate_coupons' and ot7.order_id = oo.order_id group by ot7.order_id) as sconto_title,

(Select round(SUM([login to view URL]),2) from oc_order_total ot8 where [login to view URL] like 'sub_total' and ot8.order_id = oo.order_id group by ot8.order_id) as subtotal,

(Select [login to view URL] from oc_order_total ot9 where [login to view URL] like 'shipping' and ot9.order_id = oo.order_id group by ot9.order_id) as shipping_name, [login to view URL] as affiliateFee,

(Select round(SUM([login to view URL]),2) from oc_order_total ot10 where [login to view URL] like 'shipping' and ot10.order_id = oo.order_id) as shipping_cost

FROM oc_order_total ot

INNER JOIN oc_order oo on ot.order_id = oo.order_id

INNER JOIN oc_order_product op on op.order_id = ot.order_id

INNER JOIN oc_product p on op.product_id = p.product_id

LEFT JOIN oc_affiliate_transaction oat on oat.order_id = ot.order_id

WHERE oo.store_name = 'test'

AND oo.order_status_id != 0

AND oo.date_added BETWEEN '2018-08-10' AND '2018-08-25'

GROUP BY ot.order_id

ORDER BY ot.order_total_id DESC

but i'm getting a wrong data for these due fields

'product_cost' and 'weight'

Could you help me to fix? i can not send u the db due of privacy issues, but i can send u structure table

MySQL

Project ID: #17859882

About the project

10 proposals Remote project Active 5 years ago

Awarded to:

nrislam10

Hi I think i can solve your query problem. I can start immediately. Please send me the table to start immediately. With best regards.

€15 EUR in 1 day
(2 Reviews)
2.0

10 freelancers are bidding on average €23 for this job

letshappy

please send me table structure so that i can fix the issue and i can understand that u cant share access bcz of privacy

€39 EUR in 1 day
(19 Reviews)
5.5
roshanasim

I have the ability to create back-end code that will add utility to everything the front-end designer creates. I'm passionate about the impact my skills can have in the real world, and firmly believe that I can creat More

€25 EUR in 1 day
(28 Reviews)
5.0
rrgindore

Dear sir I am mysql expert with an exposure to joins etc please initiate further for better understanding

€19 EUR in 1 day
(29 Reviews)
4.8
skfaroo123

Hi there I can do it asap and help you right now Please contact me and send me relative tables I am looking forward to your reply Regards

€30 EUR in 1 day
(1 Review)
2.6
rahulonwrk

Greeting for the Day! I am a full time freelancer and will devote entire time to your project and deliver the best client satisfaction through my perfection in this field at very reasonable cost. I believe that More

€12 EUR in 1 day
(1 Review)
0.0