MySQL类别名称而不是数字
我从数据库中获取一些运作良好的内容。类别的输出在数值上用逗号分隔,我正在寻找一种用相应的类别名称替换这些数字的方法。
sql语句:
SELECT
p.products_id as ArtID,
p.products_model as Artikelnummer,
p.products_id as ArtID,
p.products_ean as EAN,
p.products_sort as "Master Sort",
p.products_master_slave_order as "Int. Sort",
d.products_name as Artikelname,
d.products_short_description as Kurzbeschreibung,
d.products_description as Beschreibung,
CONCAT("https://127.0.0.1/",u.url_text) as url_text,
FORMAT(p.products_vpe_value,0,'de_DE') as products_vpe_value,
CONCAT(FORMAT(p.products_price,2)," EUR") as "VK Netto",
FORMAT(p.products_weight,3) as Gewicht,
p.products_shippingtime as Lieferzeit,
CONCAT("https://127.0.0.1/media/images/info/",p.products_image) as Bild1,
GROUP_CONCAT(c.categories_id ORDER by 'p.products_id' SEPARATOR ',') as Kategorie,
p.products_status as Status,
p.disabled_shippings as Spedition,
d.products_keywords as "Keyword Suche",
u.meta_title as "Meta Title 55-60",
u.meta_description as "Meta Description 150"
FROM
xt_products p
left join xt_products_description d on p.products_id = d.products_id
left join xt_products_to_categories c on p.products_id = c.products_id
left join xt_seo_url u on p.products_id = u.link_id AND u.link_type = 1
GROUP BY p.products_id
ORDER BY `ArtID` ASC
line” group_concat(c.categories_id order by'p.products_id'sapeator','')作为kategorie'创建您在pic中看到的数字。类别的名称在表Xt_categories_description> categories_id + categories_name。
有什么方法是,784,783,782可以成为CATA,CATB,CATC ...
谢谢您的帮助。
I take from a database some stuff that work well. The output of the categories is numerically separated with a comma, I am looking for a way to replace these numbers with the corresponding category names.
The sql statement:
SELECT
p.products_id as ArtID,
p.products_model as Artikelnummer,
p.products_id as ArtID,
p.products_ean as EAN,
p.products_sort as "Master Sort",
p.products_master_slave_order as "Int. Sort",
d.products_name as Artikelname,
d.products_short_description as Kurzbeschreibung,
d.products_description as Beschreibung,
CONCAT("https://127.0.0.1/",u.url_text) as url_text,
FORMAT(p.products_vpe_value,0,'de_DE') as products_vpe_value,
CONCAT(FORMAT(p.products_price,2)," EUR") as "VK Netto",
FORMAT(p.products_weight,3) as Gewicht,
p.products_shippingtime as Lieferzeit,
CONCAT("https://127.0.0.1/media/images/info/",p.products_image) as Bild1,
GROUP_CONCAT(c.categories_id ORDER by 'p.products_id' SEPARATOR ',') as Kategorie,
p.products_status as Status,
p.disabled_shippings as Spedition,
d.products_keywords as "Keyword Suche",
u.meta_title as "Meta Title 55-60",
u.meta_description as "Meta Description 150"
FROM
xt_products p
left join xt_products_description d on p.products_id = d.products_id
left join xt_products_to_categories c on p.products_id = c.products_id
left join xt_seo_url u on p.products_id = u.link_id AND u.link_type = 1
GROUP BY p.products_id
ORDER BY `ArtID` ASC
The line "GROUP_CONCAT(c.categories_id ORDER by 'p.products_id' SEPARATOR ',') as Kategorie" create the numbers you see in pic. The names of the Categories is in table xt_categories_description > categories_id + categories_name.
Is there a way that instead 784,783,782 can become CatA, CatB, CatC ...
Thank you for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论