gpt4 book ai didi

mysql - SQL从一个表中选择两次与单个表相关的字段

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

我有2张 table

--------------------------------------------
TABLE 1:
ID
DUREE_FREQ_ID => foreign key idFrequence
POSOL_FREQ_ID => foreign key idFrequence
INTER
------------------------------------------
TABLE 2:
idFrequence
libFrequence
-------------------------------------------

我想进行查询以同时获取 DUREE_FREQ_IDPOSOL_FREQ_IDlibFrequence!

最佳答案

SELECT Table1.*, t2a.libFrequence AS DUREElib, t2b.libFrequence AS POSOLlib
FROM Table1
INNER JOIN Table2 AS t2a ON Table1.DUREE_FREQ_ID = t2a.idFrequence
INNER JOIN Table2 AS t2b ON Table1.POSOL_FREQ_ID = t2b.idFrequence

关于mysql - SQL从一个表中选择两次与单个表相关的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19839587/

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