I have a big problem with combining 3 SQL queries into one simple query that returns me all I want. Is tehere any way to join these simple sql queries into one?
query1:
SELECT COUNT(FieldID) AS "CountA"
FROM table WHERE Rezervovany = 0 AND Prodany = 0
query2:
SELECT COUNT(FieldID) AS "CountB"
FROM table WHERE Rezervovany = 1 AND Prodany = 0
query3:
SELECT COUNT(FieldID) AS "CountC"
FROM table WHERE Prodany = 1
You can put your conditions in a
caseclause inside the aggregatecountfunction:Keep in mind that
countonly counts non-null values.