Subcostal nerve

The subcostal nerve (anterior division of the twelfth thoracic nerve) is larger than the others. It runs along the lower border of the twelfth rib, often gives a communicating branch to the first lumbar nerve, and passes under the lateral lumbocostal arch.
It then runs in front of the quadratus lumborum, innervates the transversus, and passes forward between it and the abdominal internal oblique to be distributed in the same manner as the lower intercostal nerves.
It communicates with the iliohypogastric nerve and the ilioinguinal nerve of the lumbar plexus, and gives a branch to the pyramidalis muscle and the quadratus lumborum muscle. It also gives off a lateral cutaneous branch that supplies sensory innervation to the skin over the hip.