Here we go:
'MplanT'
MpID | M_ID | Mplan |
MpID – primary
M_ID – foreign to 'Member' main table/Member.MemID is primary here for joining
Mplan – contains values for plan type.
Typical values: '2','4','6' that represent TypeI, TypeII, TypeIII
note: currently offering TypeI only //converting, now adding plans Type II Type III – leaving intential gaps for future plans//
The query is a little complicated with joined tables and their explanations and SELECT MAX's, I beleive this is the relevant portion as it ends off:
INNER JOIN MplanT AS plan1 ON Member.MemID = plan1.M_ID AND plan1.MpID = ( SELECT max( MpID ) FROM MplanT WHERE MplanT.Mm_ID = Member.MemID )
…ORDER BY plan1.Mplan DESC
DESIRED RESULTS:
prioritize order of TypeI, TypeII, TypeIII within a do-while, like:
Type II or Type III // in order of first and equal priority
followed by:
Type I // last