The victims included 22 children as well as adults, police said in a statement.
Earlier, police said a manhunt was under way for the shooter, and a government spokesman said the prime minister had alerted all agencies to apprehend the culprit.
Mass shootings are rare in Thailand even though the rate of gun ownership is high compared with some other countries in the region, and illegal weapons are common, Reuters news agency reported.
In 2020, a soldier angry over a property deal gone sour killed at least 29 people and wounded 57 in a rampage that spanned four locations.
Thai media wrote that this person killed his wife and daughter and then committed suicide.
MA/PR/FNA14010714000225