gpt4 book ai didi

mysql - 选择行时不需要的行

转载 作者:太空宇宙 更新时间:2023-11-03 11:53:03 27 4
gpt4 key购买 nike

以下 SELECT 查询无法正常工作:

SELECT DISTINCT
student.firstname,
student.lastname,
student.emailAddress,
cast(memberslist.dateJoined as DATE) as dateJoined
FROM student, memberslist
WHERE
memberslist.orgName = 'Elite League of Information Technology Students'
AND memberslist.joined = 'yes'

我有 2 个表:studentmemberslist

成员列表 表:
memberslist table

student 表:
student table

当我运行查询时,结果如下:

SQL query results

我不明白为什么当 WHERE 是“Elite League of Information Technology Student”时它会给我行 pakalu

最佳答案

不鼓励使用隐式连接,您需要以下查询:

SELECT s.firstname, s.lastname, s.emailAddress, cast(m.dateJoined as DATE) as dateJoined 
FROM student s INNER JOIN memberslist m
ON s.emailAddress = m.emailAddress
WHERE m.orgName = 'Elite League of Information Technology Students'
AND m.joined = 'yes'

关于mysql - 选择行时不需要的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34574114/

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