Error in SQL statement in access

1

Could someone please tell me what is the error in this sentence or what is missing?

select count(distinct BLART) from COV_SAP_AccP_LA where Country = "XXX" 

I'm doing it in access and what I want is for you to tell me separately the different data that there is in a column.

The error that appears on the screen is

  

Syntax error (missing operator) in query expression 'count (distinct BLART)'

I already reviewed several examples but I do not know if access has a different syntax.

Thanks in advance

    
asked by Viatorii 10.08.2018 в 14:41
source

2 answers

1

A suggestion can be:

SELECT count(BLART) AS [Cantidad_datos], BLART
FROM COV_SAP_AccP_LA 
WHERE Country = "XXX"
GROUP BY BLART;

The previous query generates as a result the amount of data (in this case, the amount of BLART ) .

If "for example" there is more than one element in the BLART column, it will only show the name once, but in the Cantidad_datos column the number of times it exists will be displayed.

    
answered by 10.08.2018 / 16:41
source
0

I would recommend grouping them so that you have a list of the data with their concurrences, this you do it in the following way.

select count(BLART) 
from ( select distinct BLART from COV_SAP_AccP_LA ) 
where Country = "XXX

I hope this helps you.

Greetings.

    
answered by 10.08.2018 в 14:56