SQL query is not grouping

0

I am new to SQL and I am trying to group the data according to the query below, but it is not grouping. The correct one was to exit, for example

select
    left(P.ProjDesc,6),
    COUNT(P.ProjID)
from Projetos P
where P.ProjStatus <> 9 
group by p.ProjDesc
    
asked by anonymous 20.07.2017 / 16:45

1 answer

2

Renan,

As far as I understand, you want to group from LEFT. Use the query below.

select 
     left(P.ProjDesc,6), 
     COUNT(P.ProjID) 
from 
     Projetos P 
where 
     P.ProjStatus <> 9 
group by 
     left(P.ProjDesc,6)

In this case, you will group by the same column you selected.

Hugs,

    
20.07.2017 / 17:02