gpt4 book ai didi

php - 使用单独的 where 子句连接 3 个表

转载 作者:行者123 更新时间:2023-11-29 20:33:05 26 4
gpt4 key购买 nike

我有 3 张 table :

USERS(id, username, email, password)

QUESTIONS(id, uid, type, ques, date, time)

ANSWERS(id, a_uid, qid, reply, a_date, a_time)

我想从所有三个表中选择*

where $_SESSION[‘id’] = questions.uid

& users.id = questions.uid

& questions.id = answers.qid

我怎样才能实现这个目标?

最佳答案

 select * 
from USERS
inner join QUESTIONS on users.id = questions.userid
inner join ANSWERS on questions.id = answers.qid
where questions.uid = $_SESSION['id'] ;

关于php - 使用单独的 where 子句连接 3 个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38936944/

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