- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Sqlfiddle 是 http://sqlfiddle.com/#!2/7df50/4
基本上,我有 3 个表:组、成员资格、客户。
tbl.client = client_id (PK, AI), industry_id (FK), status
tbl.membership = membership_id (PK, AI), Client_id (FK to tbl.client),
group_id (FK to group), status
tbl.group = group_id (PK, AI), target_market_id (FK), geography_id (FK)
基本上,我想通过连接所有 3 个表来选择一个 group_id,其中没有一个客户端的 client.industry_id 等于给定的输入 ($client_industry_id)。
到目前为止我的查询是:
"select g.group_id from `group` g join membership m on m.group_id=g.group_id ".
"join client c on c.client_id=m.client_id ".
"where g.status=1 and m.status=1 and c.status=1 and ".
"g.geography_id=$target_geography and ".
"g.target_market_id=$target_market ".
"c.industry_id <> $client_industry_id";
该查询的问题在于,它仍然会从组中选择一个 group_id,因为所有客户端都不能具有 client_id = $client_industry_id 才能触发 <>。我希望这是有道理的?
我可以通过分组来解决这个问题吗?如果语句?
编辑:
insert into client (email, industry_id, status) VALUES ('email1@gmail.com', '1', '1')
insert into client (email, industry_id, status) VALUES ('email2@gmail.com', '2', '1')
insert into client (email, industry_id, status) VALUES ('email3@gmail.com', '2', '1')
insert into membership (client_id, group_id) VALUES (1, 1)
insert into membership (client_id, group_id) VALUES (2, 1)
insert into membership (client_id, group_id) VALUES (3, 2)
insert into group (geography_id, target_market_id) VALUES (1, 1)
insert into group (geography_id, target_market_id) VALUES (1, 1)
#psuedo code
"select group_id from group join membership on group_id, join client on client_id where
all status=1 and group.geography_id=1 and group.target_market_id=1 and
NONE of the clients have client.industry_id=1
-- query should result in group_id=2
最佳答案
你和@Strawberry是对的,之前的代码是行不通的。对于那个很抱歉。以下是您可能想尝试的快速破解方法:
select g.group_id from groupp g
join membership m on m.group_id=g.group_id and m.status=1 //to consider check on status
join client c on c.client_id=m.client_id and c.status=1 //to consider check on status
where g.group_id not in (select mm.group_id from membership mm join client cc on mm.client_id=cc.client_id and cc.industry_id = $client_industry_id) and //to exclude groups with clients that have industry
g.status=1 and
g.geography_id=$target_geography and
g.target_market_id=$target_market;
关于MySQL查询: select group_id but if any client_id in said group is = X then don't select,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14353173/
我正在使用 django-social-auth 为我的 django 项目进行 google apps 身份验证。我从我的域的 Google api 控制台获取了客户端 ID 和 key 。并按如下
当我尝试使用 next auth 创建一个 discord oauth 客户端并单击登录时,出现此错误: https://next-auth.js.org/errors#get_authorizati
我已经设置了用于单点登录的 Azure AD 应用程序。我按照微软的教程https://dev.onedrive.com/auth/aad_oauth.htm设置此 upp,大多数情况下一切正常。
我是基于 Facebook 的开发的新手,只需要一个基本的 Facebook 注册表,我找到了“注册表及其 html 以嵌入我的网站”,但需要一个 client_id 以便我可以使用它。我从哪里得到这
我正在尝试根据 client_id 使用不同的登录页面。 用例:我的默认登录页面是经典的用户名/密码类型登录,但对于特定的 client_id,登录页面要求提供 3 种不同的信息,其中一种是他在邮件中
我正在尝试根据 client_id 使用不同的登录页面。 用例:我的默认登录页面是经典的用户名/密码类型登录,但对于特定的 client_id,登录页面要求提供 3 种不同的信息,其中一种是他在邮件中
我已经使用 Web API 2 实现了 Google 身份验证并收到以下错误: The given URL is not allowed by Client_id 'ngAuthApp' config
我有一个 API,用于我正在开发的项目。我收到客户端 ID 的关键错误,我必须传递该错误才能调用 api。我使用的 api 是 Synapse。如果有人知道导致错误的原因或我如何修复此关键错误,这将是
我一直在使用 LinkedIn api (OAuth 2),并且找到了一个示例来帮助测试它。我已严格按照教程进行操作,但由于某种原因,当我提供完整的重定向 URL(按照代码中的要求)时,出现错误:(i
我有五张 table ;客户、第一部分、第二部分、第三部分、第四部分。输入数据后,每个表都会自动在第一个字段中填充 client_id。我想检索网站上特定客户端的每个表(第一节、第二节、第三节、第四节
目前我正尝试在我的网络应用程序上连接 paypal oauth 登录。但是我收到了这个错误 客户端代码 paypal.use(["login"], function (login) {
我试图从 hms 服务器请求一个 oauth token ,但它总是返回 missing required parameter: client_id 给我。 url: https://oauth-lo
当我使用 Oauth2.0 从谷歌联系人 API 获得响应时,它返回的响应如下所示 “该网站 251543634636.apps.googleusercontent.com 正在请求访问您的 Goog
有点 OAUTH 的初学者,想问我是否理解正确。我正在使用 OWIN 和 C#,并设置以下场景: 用户向我的 token 端点发出请求,传入用户名/密码和密码 grant_type。如果凭据有效,那么
我遇到了一个我不明白的问题!我正在开发一个react-native(js)应用程序,它尝试使用隐式授权流访问Spotify api。 这是我获取访问 token 的方法: async function
在移动平台上使用带有 OAuth2 的用户代理流程时,授权服务器无法验证应用程序的 client_id。 因此,任何人都可以通过复制 client_id 来冒充我的应用程序(从而代表我获取所有访问 t
我正在尝试从 SoundCloud 为 HTML5 播放器传输音乐,我希望它(其核心)像这个 fiddle http://jsfiddle.net/kS97M/5/ 一样工作。 SC.initiali
我正在尝试使用 Javascript 从 ArcGIS Online 服务获取 token 。但是,它总是返回一个错误,表明未指定 client_id。 我做的一切都在这里吗? var My
是否有某种我可以通过扩展访问的唯一客户端 ID,如果没有,我是否可以永久设置某种 UUID(例如 IE 注册表或 FF 中的全局首选项)?我不想每次用户重新安装我的扩展程序时都重新生成 UUID。 谢
所以我刚刚从 LinkedIn oauth 1.0 升级到 2.0,我已经收到这个错误大约一天了。我在 php 上看到了一篇关于它的帖子,但我无法在 Node JS (Javascript) 中弄清楚
我是一名优秀的程序员,十分优秀!