Skip to content
Advertisement

How to union two counts queries in SQLAlchemy?

I have two queries and the only difference between then is that one is counting the success status and the other failure status. Is there a way to get this result in just one query? I’m using SQLALchemy to do the queries.

JavaScript
JavaScript

Advertisement

Answer

You can use conditions on Count, your query will look like:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement