The victims included 24 children and 12 adults, according to a report posted on the Facebook page of the provincial public relations department, Xinhua news agency reported.
Another 12 people were reportedly injured.
The shooting occurred at around 12:40 pm local time (0540 GMT), local police said.
The attacker, reportedly a 34-year-old former police officer, later killed his family members before taking his own life, Kornwit Nitkhamhan, deputy inspector at Na Klang Police Station where the childcare centre is located, told Xinhua via phone.
"About the horrifying incident, I would like to extend my deepest condolences to the families of the dead and injured," Thai Prime Minister Prayut Chan-o-cha wrote on his Facebook account, adding that he has ordered the national police chief to "fast-track an investigation".
TV footage showed ambulances and families of the victims gathering outside the childcare centre.
A woman working at the childcare centre told a local TV programme that they were having lunch when she heard the sound and saw the injured falling to the ground. The shooter broke the window in as the door was locked and succeeded in fleeing the scene, she said.
Many locals rushed to the Nong Bua Lamphu provincial hospital in response to its urgent call for blood donations for the injured.