Search code examples
sqlms-accessgroup-bycounthaving

sql query to have all yes in a column


I'm trying to make a sql query to only have the "yes" value in a column named checked but it always return me "no" value too like this on Microsoft Access :

CHECKED | POINTS VUS
NULL    | 4
YES     | 4

If anyone could help me . Thank you very much. Here is my query :

SELECT
  CHECKED, 
  COUNT(*) AS `POINTS VUS`
FROM
  ARCHPOINTS
GROUP BY CHECKED 
HAVING COUNT(*) = yes

Solution

  • I think you can try this =>

    SELECT
      CHECKED,
      COUNT(*) AS `POINTS VUS`
    FROM
      ARCHPOINTS
      WHERE CHECKED='yes'
      GROUP BY CHECKED