Question: Question:

What are the total distributions in 2020 from properties that were acquired in 2019 broken down by state?

So far this is what I have and seems like I am not getting it right to sum up? what step am I missing. I am not getting an error but not getting an answer either? Any ideas?

```
CREATE TABLE Property
(
    hmy INT   NOT NULL,
    scode VARCHAR   NOT NULL,
    saddr1 VARCHAR NOT NULL,
    saddr2 VARCHAR NOT NULL,
    scity VARCHAR NOT NULL,
    sstate VARCHAR NOT NULL,
    szipcode INT NOT NULL,
    PRIMARY KEY (hmy) 
);

CREATE TABLE PropInfo
(
    hmy INT   NOT NULL,
    hcode INT   NOT NULL,
    acquisitiondate DATE   NOT NULL,
    unitcount INT   NOT NULL,
    yearbuilt INT   NOT NULL,
    distributionentitycode VARCHAR   NOT NULL,
    PRIMARY KEY (hcode)
);

CREATE TABLE DistributionLog
(
    hmy INT   NOT NULL,
    hcode INT   NOT NULL,
    distributionDate DATE   NOT NULL,
    distributiontype VARCHAR   NOT NULL,
    distributionamount INT   NOT NULL,
    PRIMARY KEY (hmy)
);

SELECT SUM(DL.distributionamount) AS Total, PY.sstate, PI.acquisitiondate, DL.distributionamount 
FROM DistributionLog AS DL
JOIN PropInfo AS PI
ON PI.hmy = DL.hcode
JOIN Property AS PY
ON PY.hmy = PI.hmy
WHERE distributionDate BETWEEN '2020-1-1' AND '2020-12-31'
GROUP BY PY.sstate, PI.acquisitiondate, DL.distributionamount
ORDER BY PY.sstate;

```

Here's what was tried:

[![enter image description here](https://i.stack.imgur.com/vYLeI.png)](https://i.stack.imgur.com/vYLeI.png)

Answer: 
The problem should comes from the encoding and decoding. When users try editing the ini file from windows Notepad, especially the non-english windows users, the ini file will be changed to some other default encodings. Some hidden chars will show up then, however you won't see it from any text editor, but unfortunately Python will read those hidden chars.

I'm not quite sure about Japanese language. When I deal with Simplified/Traditional Chinese Windows/Linux Ubuntu/MacOS ini files encoding, read/write the ini files in "utf-8-sig" works for me, you can give it a shot.

```
with open('config.ini', 'r', encoding='utf-8-sig') as f:
    ...

```
I solved it. The file was saved as 'UTF-8 with BOM' encoding. When it is edited and saved by notepad in windows, it will be automatically saved as like this.