Mattress stitch is a cool way to vertically connect two pieces of Stockinette Stitch fabric so it looks seamless (though you can feel the seam if you're looking for it). For the purposes of illustration, different colored swatches are used in the photographs.
Mattress stitch can be worked either a half stitch or a whole stitch in from the edge of the knitting, though it's much easier to do a full stitch in because you aren't working in the messy edge stitches.
You can work with the tail left over from casting on or binding off if you like, or join in a new piece of yarn, beginning just as you would when weaving in an end. In this tutorial I'm working with the tail end of the blue yarn and starting on the right-hand piece from the bottom.
To begin, give your knitting a gentle pull between the first row and the second row of knitting. You'll see a series of little bars of yarn running between the stitches. These are what you use to stitch the pieces together.
Slide your sewing needle under the first bar.