Tell me how to make a request so that it is sorted by the sum of two fields, for example:

SELECT "name","prais1","prais2" FROM "tovari", 

I need the query to be sorted in ascending order prais1+prais2

  • close the question - FoxManiac

2 answers 2

 SELECT name, paris1, paris2, (paris1+paris2) as paris FROM `tovari` ORDER BY paris 
  • thank you so much - amn111
 SELECT name, prais1, parais2, SUM(prais1 + parais2) as myfield FROM tovati ORDER BY myfield 
  • one
    At the same time))) - Yoharny Babai
  • Is the answer correct? ) - FoxManiac
  • Probably have not checked yet) - Yoharny Babai
  • There is no base at hand. Try adding GROUP BY SELECT name, prais1, parais2, SUM (prais1 + parais2) as myfield FROM tovati GROUP BY name ORDER BY myfield - ilovetrancekrsk