gpt4 book ai didi

php - 从 id 相同的其他表中提取名称/值

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

分销商表

name          id
usf south 1
usf north 2
usf east 3
usf west 4

奥吉表

distributor    itemname
1 cheese
1 apples
3 oranges
2 pineapples

我目前在页面上为每个项目名称显示的“ogi 表”的“分销商”列中找到了编号。但是,我想将此号码更改为正确的经销商名称,可在“经销商表”中找到。我该怎么做?

感谢您的协助。

最佳答案

如果您只想替换查询而不替换任何底层编程,这可能是一个可行的解决方案:

SELECT
ogi.itemname,
distributors.name AS distributor
FROM
ogi
INNER JOIN
distributors
ON
ogi.distributor = distributors.id

关于php - 从 id 相同的其他表中提取名称/值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14719477/

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