MySQL Forums
Forum List  »  General

How can I get a sum from specific fields in where clause?
Posted by: Bad Programmer
Date: April 08, 2022 10:11AM

I've got a table with QID numeric id, MX numeric id, MA numeric id, Answer text fields.
Multiple MX exist for each QID and multiple MA exist for each MX
The values in the text field are numeric.

This part of the query is the first parameter in an if:
WHERE ... AND if(QID <> GivenQID, TRUE, if(TheQuery, TRUE, FALSE)) = TRUE

TheQuery: SUM(Answer) of any specific MX >= GivenValue

How do I write TheQuery in MySql?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.