Do you establish relationships for these tables based on [id] field? Why the relationship between 'crews' and 'orders' is one to many but that between 'crews' and 'crew_states' is many to one? Also, I noticed that the values of [id] in crew_operable_time are not matched with [id] in 'crews'.
For that "I need a graph with the count the number of crews for each order by "crew_states" or the count the number of crews by hour", it is too general to imagine such a report. Could you please post an image to show us your desired result? Since your dataset is very large, would you please simplify and post sample data to help me better understand?
Community Support Team _ Yuliana Gu If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.