I would like left join an explain statement like this. Actually a need to retrieve the datatype of column and column is stored in another table named ‘wyspesific’ .
select
st.segnam as Segment,
st.typnam as 'Sub-Segment',
group_concat(distinct ws.fldnam) as 'Field Tag Name (database)',
group_concat(distinct ws.fldcap) as 'Field Name Label',
concat('(', group_concat(distinct of.optcap order by of.optcap desc ),')' ) as optionFieldLabel,
concat('(', group_concat(distinct of.optval order by of.optcap desc ),')' ) as optionFieldValue,
ws.isopt as isOptionField
from shiptype st
left join wyspecific ws on ws.wytypid = st.wytypid and ws.enabled = 'Y'
left join optionfields of on of.fldnam = ws.fldnam and of.deleted = 'N'
left join ( explain shipspecific ) as v on ws.fldnam = v.Field
where st.segid in(6,4,8,9,10,11,12 ) and ws.enabled = 'Y'
group by ws.fldid
order by st.segid
Any suggestion or ideas would be greatly appreciated.
Thanks a lot.
You should pull this information from INFORMATION_SCHEMA.COLUMNS instead: