gpt4 book ai didi

mysql - 我想隐藏 id,如果不喜欢,但不起作用 SELECT * FROM 字符,character_actor WHERE 字符.id 不喜欢character_actor.character_id;

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

如果不喜欢,我想隐藏 id,但不起作用

SELECT * FROM character, character_actor WHERE character.id NOT LIKE character_actor.character_id;

id  name    id  character_id    actor_name
1 Doogie Howser 1 4 Alyson Hannigan
1 Doogie Howser 2 3 Alyson Hannigan
1 Doogie Howser 3 2 Neil Patrick Harris
2 Barney Stinson 1 4 Alyson Hannigan
2 Barney Stinson 2 3 Alyson Hannigan
2 Barney Stinson 4 1 Neil Patrick Harris
3 Lily Aldrin 1 4 Alyson Hannigan
3 Lily Aldrin 3 2 Neil Patrick Harris
3 Lily Aldrin 4 1 Neil Patrick Harris
4 Willow Rosenberg 2 3 Alyson Hannigan
4 Willow Rosenberg 3 2 Neil Patrick Harris
4 Willow Rosenberg 4 1 Neil Patrick Harris

最佳答案

您想要一个 NOT IN 查询:

SELECT *
FROM character WHERE character.id NOT IN (SELECT character_actor.character_id from character_actor)

也可以通过 NOT EXISTS 来完成。根据 DBMS 和结构,这可能会带来更好的性能。

SELECT *
FROM character c WHERE NOT EXISTS(SELECT NULL from character_actor ca WHERE ca.character_id=c.id)

关于mysql - 我想隐藏 id,如果不喜欢,但不起作用 SELECT * FROM 字符,character_actor WHERE 字符.id 不喜欢character_actor.character_id;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50999020/

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