gpt4 book ai didi

php - 通过连接从 2 个以上 mysql 表中获取数据。

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

这是我的表结构。

Table1  // it has 4 colums,that saves all the question posted by user

id|question|answer|postby|

Table2 //it has 2 colums, that saves all the signed up users

id|username|email|

Table3 //it saves that which question is read by which user.

id|reader_id|question_id|

注意:reader_id是表2的id。

问题:我们需要找出特定用户没有阅读的问题。

最佳答案

select * from table1 where id not in (
select question_id from table3 where reader_id = [particular user id]
)

关于php - 通过连接从 2 个以上 mysql 表中获取数据。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22059973/

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