The invention discloses a stator assembly and a motor. The stator assembly comprises a stator core and a stator winding, the stator core is provided with N grooves, the stator winding is formed by winding a plurality of hairpin coils in the grooves, each phase of stator winding comprises two sub-windings, each sub-winding is provided with a plurality of hairpin coils, and the hairpin coils are distributed in L different layers of the N grooves. The plurality of hairpin coils of each sub-winding comprise a first hairpin coil positioned on a first layer, a second hairpin coil positioned on an Lth layer, and middle hairpin coils positioned between the first layer and the Lth layer; one of the two first hairpin coils is a long-distance hairpin coil, the other hairpin coil is a short-distance hairpin coil, one of the two second hairpin coils is a short-distance hairpin coil correspondingly, and the other hairpin coil is a long-distance hairpin coil; the total number of the middle hairpin coils of the two sub-windings is the same, the pitch types of the middle hairpin coils are the same, and the distribution of the pitch types is the same. Counter electromotive force, resistance and inductance of all the sub-windings are the same, and the assembly efficiency of the windings is improved.