Select Count(*), tanggal as totRits And Count(*), total as tNote From tblsolar Where tanggal like '%" & sqlDate & "%' And supir like '%" & cboSupir & "%' Group By tanggal
how to select count two time
Select Count(*), tanggal as totRits And Count(*), total as tNote From tblsolar Where tanggal like '%" & sqlDate & "%' And supir like '%" & cboSupir & "%' Group By tanggal
how to select count two time
This COUNT function is used to find the number of indexes as returned from the query selected.
Please see the below example-
SELECT COUNT(Column1), COUNT(Column2) FROM Table;
If you want to get the total COUNT and a COUNT of a specific column using different conditions, you can use a subquery like this:
SELECT
(SELECT
COUNT(tanggal) AS totRits
FROM tblsolar
WHERE tanggal LIKE '%sqlDate%'
AND supir LIKE '%cboSupir%'
GROUP By tanggal) AS totRits,
COUNT(*) AS tNote
FROM tblsolar
Input:
| tanggal | supir |
|---|---|
| sqlDate | cboSupir |
| test | test |
| test | cboSupir |
| test | cboSupir |
| sqlDate | cboSupir |
Output:
| totRits | tNote |
|---|---|
| 2 | 5 |
Adjust your WHERE clause conditions as needed for both the main query and subquery.
db<>fiddle here.