Skip to content
Advertisement

Compare two results in MySQL [closed]

I want to get an average of Customers total purchase and store it in @x

Then I want to store an average of Supplier total purchase and store it in @y

And then do some comparisons, It would be nice if anyone can help out. And here is the table relations

Advertisement

Answer

it is quite hard to navigate your tables so i ll just post an example of something similar i did with my project:

  SELECT (SELECT AVG(amount) FROM `vw_on_report`) as x, (SELECT AVG(amount) FROM `vw_off_report`) as y
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement