Mattress stitch is the perfect seam for sewing together two pieces of knitted stockinette fabric at the selvedges. This seam done properly may add needed structure to your knits.
Thread a darning needle with the same yarn used to knit the project. If the yarn is very thick, peel one ply off and use this in your needle for a less bulky seam. Although the sewing yarn will be hidden by the seam, it can show when stretched, so a closely matching yarn is best.
The step-by-step instructions shown in the Mattress Stitch gallery (below) are done at the edge stitch, which leaves a minimal inner seam and saves yarn. It is more commonly shown done one stitch away from the edge, which makes a more substantial inner seam.