It all depends on which school district you live in and what are their requirements. Some school district follows the "neighborhood school" where you go to the school nearest to your house. Some school district follows the "school choice" where you can apply to any school within that district. Some school districts will let you apply to a school within their district just because you work in that city but you don't live there. You need to find out what the requirements is at the school district where you want to send your child to.
Also, there might be some flexibilities in the school requirement so you need to tell them about your situation and see if they could work with you and help you out. I know of a parent who lives and works in different cities. The parent want her child to go to the school where she works in but that school district has the "neighborhood school" regulation - you must live in that city to attend the school in that city. After months of going to the central office of the school district, she was able to convince someone to give her son a spot at a local school near her work place.