0

I want to see the number for each category by using distinct. But receiving only ones (1) for every category

Can you please suggest how can I change my statement?

At the moment I have following:

    %sql
select catNum , count(catNum) as Number from 
(SELECT DISTINCT catNum
      FROM history_new
      where (seatarea == 'Unknown' or seatarea is null) 
      and catNum is not null 
      and seasonname = '2022/23') group by catNum

Thank you

Anna
  • 1
  • 1
  • 4
  • 1
    You're receiving 1's because your inner query is just selecting the "distinct" catnum. Remove Distinct is your likely solution. Or don't bother wrapping your query, and just say `select catnum, count(*) from .... group by catnum` – Isolated Oct 06 '22 at 14:20

0 Answers0