SELECT COUNT(*),
tanggal as totRits AND COUNT(*),
total AS tNote
FROM tblsolar
WHERE tanggal LIKE '%" & sqlDate & "%'
AND supir LIKE '%" & cboSupir & "%'
GROUP BY tanggal
How do I SELECT
the COUNT
two times?
SELECT COUNT(*),
tanggal as totRits AND COUNT(*),
total AS tNote
FROM tblsolar
WHERE tanggal LIKE '%" & sqlDate & "%'
AND supir LIKE '%" & cboSupir & "%'
GROUP BY tanggal
How do I SELECT
the COUNT
two times?
2
Answers
This
COUNT
function is used to find the number of indexes as returned from the query selected.Please see the below example-
If you want to get the total
COUNT
and aCOUNT
of a specific column using different conditions, you can use a subquery like this:Input:
Output:
Adjust your
WHERE
clause conditions as needed for both the main query and subquery.db<>fiddle here.