gpt4 book ai didi

mysql - mysql查询中可以保留join解释语句吗?

转载 作者:行者123 更新时间:2023-11-29 09:01:05 25 4
gpt4 key购买 nike

我想左加入这样的解释语句。实际上需要检索列的数据类型,并且列存储在另一个名为“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

任何建议或想法将不胜感激。

非常感谢。

最佳答案

您应该从 INFORMATION_SCHEMA.COLUMNS 获取此信息相反:

SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='shipspecific' AND TABLE_SCHEMA=DATABASE()

关于mysql - mysql查询中可以保留join解释语句吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8604442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com