If you put together a 'harmonized diatonic chord scale' you will see the substitutions lining up for you.
E.G. In the key of G:
f# g a b c d e f# g a b c
d e f# g a b c d e f# g a
b c d e f# g a b c d e f#
G A B C D E F# G A B C D
I II III IV V VI VII I II III IV V etc etc
The capital letter at the bottom is the root of the chord and the Roman numerals represent the position in the scale.
The chords always come out as:
I = Maj 7
II = min 7
III = min 7
IV = Maj 7
V = Dom 7
VI = min 7
VII = min7 b5 (half diminished)
So in this key, you have G Maj 7, A min 7, B min 7, C Maj 7 etc.
As an example, if you look at the II chord (A min 7) and the VII chord (f# min7 b5), you will see three of the same notes.
That means that if the bass player is playing an F#, you cna play an Amin chord and it will sound just right, because it is the same notes as the f# m 7b5. Here's where it gets tricky, tho.
Stay away from the low notes, as you will be too close to the bass player and it will sound muddy, and if you play an Amin7, you will have a pretty significant clash between the 'g' in your Amin7 and the f# the bass player is playing so only play the triad (a, c, e).
You have to know where you're going and be able to resolve to a chord tone as a point of rest, or it will sound really nasty (unless you really know what you're doing, in which case you can make it work). The strongest resolution is the fifth of the chord, followed by the third, then the root and then the seventh. Check out David Gilmour for the sweetest resolver on the planet.
The cool thing about these subs is that you can also substitute solo lines in the same way.
E.G. a cool lick in B min will sound great over a G Maj 7, too (take a look at the chord structure above and you'll see why.
A good way to learn this is to write out the chord scale for every key and learn them to where you don't have to think about them.
What other chords have a lot of the same notes?
foo