How to sew a hat that's not in the round

Hello. I have a pattern for a hat I am making and I’m knitting it flat . it has 5 in of ribbing and the rest is in a cable pattern. I am trying to sew it closed and I don’t know how to. Can someone help me please ??? The ribbing has to be folded and then sewed.

The neatest way to seam is mattress stitch. If you can possibly use it on your hat, it’s makes a close to invisible seam. Here’s the video for seamingstockinette stand one for reverse stockinette st which may be what you need if your cable area is on a background of purl sts.

If the ribbed edge of the hat folds over, you’ll want to start the seam with the inside of the hat facing you. That way, when the edge is folded over, the seam will be hidden in the fold. Once the seam is past the fold line (or almost to the edge of the ribbing), turn the hat with the outside facing and continue the seam up the crown.